handle reject follow

This commit is contained in:
Ted Unangst 2020-10-13 15:12:56 -04:00
parent 3b8fee642b
commit 59b5b61890
2 changed files with 23 additions and 0 deletions

View File

@ -1820,3 +1820,24 @@ func followyou2(user *WhatAbout, j junk.Junk) {
return return
} }
} }
func nofollowyou2(user *WhatAbout, j junk.Junk) {
who, _ := j.GetString("actor")
log.Printf("updating honker reject: %s", who)
db := opendatabase()
row := db.QueryRow("select name, folxid from honkers where userid = ? and xid = ? and flavor in ('presub', 'sub')",
user.ID, who)
var name, folxid string
err := row.Scan(&name, &folxid)
if err != nil {
log.Printf("can't get honker name: %s", err)
return
}
_, err = stmtUpdateFlavor.Exec("unsub", folxid, user.ID, name, who, "presub")
_, err = stmtUpdateFlavor.Exec("unsub", folxid, user.ID, name, who, "sub")
if err != nil {
log.Printf("error updating honker: %s", err)
return
}
}

2
web.go
View File

@ -380,6 +380,8 @@ func inbox(w http.ResponseWriter, r *http.Request) {
followme(user, who, who, j) followme(user, who, who, j)
case "Accept": case "Accept":
followyou2(user, j) followyou2(user, j)
case "Reject":
nofollowyou2(user, j)
case "Update": case "Update":
obj, ok := j.GetMap("object") obj, ok := j.GetMap("object")
if ok { if ok {