all repos — honk @ 21337919ef01b599943effd53f0dca203d861831

my fork of honk

reuse correct apid for undo follow
Ted Unangst tedu@tedunangst.com
Thu, 10 Sep 2020 14:52:24 -0400
commit

21337919ef01b599943effd53f0dca203d861831

parent

1c48755b4d684e80252b0ce284f4426dda429f57

1 files changed, 16 insertions(+), 16 deletions(-)

jump to
M activity.goactivity.go

@@ -996,33 +996,33 @@

deliverate(0, user.ID, actor, j.ToBytes()) } -func itakeitallback(user *WhatAbout, xid string) { +func itakeitallback(user *WhatAbout, xid string, owner string, folxid string) { j := junk.New() j["@context"] = itiswhatitis - j["id"] = user.URL + "/unsub/" + url.QueryEscape(xid) + j["id"] = user.URL + "/unsub/" + folxid j["type"] = "Undo" j["actor"] = user.URL - j["to"] = xid + j["to"] = owner f := junk.New() - f["id"] = user.URL + "/sub/" + xfiltrate() + f["id"] = user.URL + "/sub/" + folxid f["type"] = "Follow" f["actor"] = user.URL - f["to"] = xid + f["to"] = owner f["object"] = xid j["object"] = f j["published"] = time.Now().UTC().Format(time.RFC3339) - deliverate(0, user.ID, xid, j.ToBytes()) + deliverate(0, user.ID, owner, j.ToBytes()) } -func subsub(user *WhatAbout, xid string, owner string) { +func subsub(user *WhatAbout, xid string, owner string, folxid string) { if xid == "" { log.Printf("can't subscribe to empty") return } j := junk.New() j["@context"] = itiswhatitis - j["id"] = user.URL + "/sub/" + xfiltrate() + j["id"] = user.URL + "/sub/" + folxid j["type"] = "Follow" j["actor"] = user.URL j["to"] = owner

@@ -1739,21 +1739,22 @@ if err != nil {

log.Printf("can't get honker xid: %s", err) return } - log.Printf("resubscribing to %s", url) - _, err = db.Exec("update honkers set flavor = ? where honkerid = ?", "presub", honkerid) + folxid := xfiltrate() + log.Printf("subscribing to %s", url) + _, err = db.Exec("update honkers set flavor = ?, folxid = ? where honkerid = ?", "presub", folxid, honkerid) if err != nil { log.Printf("error updating honker: %s", err) return } - go subsub(user, url, owner) + go subsub(user, url, owner, folxid) } func unfollowyou(user *WhatAbout, honkerid int64) { - var url string db := opendatabase() - row := db.QueryRow("select xid from honkers where honkerid = ? and userid = ? and flavor in ('sub')", + row := db.QueryRow("select xid, owner, folxid from honkers where honkerid = ? and userid = ? and flavor in ('sub')", honkerid, user.ID) - err := row.Scan(&url) + var url, owner, folxid string + err := row.Scan(&url, &owner, &folxid) if err != nil { log.Printf("can't get honker xid: %s", err) return

@@ -1764,8 +1765,7 @@ if err != nil {

log.Printf("error updating honker: %s", err) return } - go itakeitallback(user, url) - + go itakeitallback(user, url, owner, folxid) } func followyou2(user *WhatAbout, j junk.Junk) {