all repos — honk @ 80ba1450e91dc856cdf16b4cb404b138cf4fb1cd

my fork of honk

allow unfollow by id
Ted Unangst tedu@tedunangst.com
Mon, 14 Sep 2020 15:44:21 -0400
commit

80ba1450e91dc856cdf16b4cb404b138cf4fb1cd

parent

883d95f06f2448e55b5fdecd6ccb3f9aa83aa21f

2 files changed, 19 insertions(+), 1 deletions(-)

jump to
M activity.goactivity.go

@@ -1723,7 +1723,20 @@ go rubadubdub(user, j)

} func unfollowme(user *WhatAbout, who string, name string, j junk.Junk) { - folxid, _ := j.GetString("id") + var folxid string + if who == "" { + folxid, _ = j.GetString("object") + + db := opendatabase() + row := db.QueryRow("select xid, name from honkers where userid = ? and folxid = ? and flavor in ('dub', 'undub')", user.ID, folxid) + err := row.Scan(&who, &name) + if err != nil { + if err != sql.ErrNoRows { + log.Printf("error scanning honker: %s", err) + } + return + } + } log.Printf("updating honker undo: %s %s", who, folxid) _, err := stmtUpdateFlavor.Exec("undub", folxid, user.ID, name, who, "dub")
M web.goweb.go

@@ -399,6 +399,11 @@ dumpactivity(j)

case "Undo": obj, ok := j.GetMap("object") if !ok { + folxid, ok := j.GetString("object") + if ok && originate(folxid) == origin { + unfollowme(user, "", "", j) + return + } log.Printf("unknown undo no object") dumpactivity(j) return