all repos — honk @ ca738edc74e69fa53f84f376f6b1e38518f6b3ef

my fork of honk

more control over reaction in web backend
Ted Unangst tedu@tedunangst.com
Sun, 26 Apr 2020 14:36:11 -0400
commit

ca738edc74e69fa53f84f376f6b1e38518f6b3ef

parent

7ed3b24f1a2c7c1d9fed8486ebe3cdb7bf3edb41

2 files changed, 13 insertions(+), 8 deletions(-)

jump to
M activity.goactivity.go

@@ -1145,7 +1145,7 @@ j["object"] = h.XID

if h.Convoy != "" { j["context"] = h.Convoy } - j["content"] = user.Options.Reaction + j["content"] = h.Noise case "deack": b := junk.New() b["id"] = user.URL + "/" + "ack" + "/" + shortxid(h.XID)
M web.goweb.go

@@ -1233,12 +1233,13 @@ }

} } -func sendzonkofsorts(xonk *Honk, user *WhatAbout, what string) { +func sendzonkofsorts(xonk *Honk, user *WhatAbout, what string, aux string) { zonk := &Honk{ What: what, XID: xonk.XID, Date: time.Now().UTC(), Audience: oneofakind(xonk.Audience), + Noise: aux, } zonk.Public = loudandproud(zonk.Audience)

@@ -1275,7 +1276,11 @@ return

} if wherefore == "react" { - if user.Options.Reaction == "none" { + reaction := user.Options.Reaction + if r2 := r.FormValue("reaction"); r2 != "" { + reaction = r2 + } + if reaction == "none" { return } xonk := getxonk(userinfo.UserID, what)

@@ -1284,7 +1289,7 @@ _, err := stmtUpdateFlags.Exec(flagIsReacted, xonk.ID)

if err != nil { log.Printf("error saving: %s", err) } - sendzonkofsorts(xonk, user, "react") + sendzonkofsorts(xonk, user, "react", reaction) } return }

@@ -1299,7 +1304,7 @@ _, err := stmtUpdateFlags.Exec(flagIsAcked, xonk.ID)

if err != nil { log.Printf("error acking: %s", err) } - sendzonkofsorts(xonk, user, "ack") + sendzonkofsorts(xonk, user, "ack", "") } return }

@@ -1311,7 +1316,7 @@ _, err := stmtClearFlags.Exec(flagIsAcked, xonk.ID)

if err != nil { log.Printf("error deacking: %s", err) } - sendzonkofsorts(xonk, user, "deack") + sendzonkofsorts(xonk, user, "deack", "") } return }

@@ -1325,7 +1330,7 @@ _, err := stmtClearFlags.Exec(flagIsBonked, xonk.ID)

if err != nil { log.Printf("error unbonking: %s", err) } - sendzonkofsorts(xonk, user, "unbonk") + sendzonkofsorts(xonk, user, "unbonk", "") } return }

@@ -1351,7 +1356,7 @@ xonk := getxonk(userinfo.UserID, what)

if xonk != nil { deletehonk(xonk.ID) if xonk.Whofore == 2 || xonk.Whofore == 3 { - sendzonkofsorts(xonk, user, "zonk") + sendzonkofsorts(xonk, user, "zonk", "") } } }