experimental reactions
Ted Unangst tedu@tedunangst.com
Thu, 23 Jan 2020 18:08:15 -0500
6 files changed,
35 insertions(+),
0 deletions(-)
M
activity.go
→
activity.go
@@ -1152,6 +1152,13 @@ j["object"] = h.XID
if h.Convoy != "" { j["context"] = h.Convoy } + case "react": + j["type"] = "EmojiReaction" + j["object"] = h.XID + if h.Convoy != "" { + j["context"] = h.Convoy + } + j["content"] = user.Options.Reaction case "deack": b := junk.New() b["id"] = user.URL + "/" + "ack" + "/" + shortxid(h.XID)
M
database.go
→
database.go
@@ -50,6 +50,9 @@ }
} else { user.URL = fmt.Sprintf("https://%s/%s", serverName, user.Name) } + if user.Options.Reaction == "" { + user.Options.Reaction = "😞" + } return user, nil }
M
docs/changelog.txt
→
docs/changelog.txt
@@ -2,6 +2,8 @@ changelog
=== next +--- Add Reactions. + + Quick fix to hide all images. + Allow resending follow requests.
M
honk.go
→
honk.go
@@ -51,6 +51,7 @@ SkinnyCSS bool `json:",omitempty"`
OmitImages bool `json:",omitempty"` Avatar string `json:",omitempty"` MapLink string `json:",omitempty"` + Reaction string `json:",omitempty"` } type KeyInfo struct {@@ -108,6 +109,7 @@ flagIsAcked = 1
flagIsBonked = 2 flagIsSaved = 4 flagIsUntagged = 8 + flagIsReacted = 16 ) func (honk *Honk) IsAcked() bool {@@ -124,6 +126,10 @@ }
func (honk *Honk) IsUntagged() bool { return honk.Flags&flagIsUntagged != 0 +} + +func (honk *Honk) IsReacted() bool { + return honk.Flags&flagIsReacted != 0 } type Donk struct {
M
views/honk.html
→
views/honk.html
@@ -121,6 +121,11 @@ {{ else }}
<button onclick="return flogit(this, 'untag', '{{ .Honk.XID }}');">untag me</button> {{ end }} <button><a href="/edit?xid={{ .Honk.XID }}">edit</a></button> +{{ if .Honk.IsReacted }} +<button disabled>reacted</button> +{{ else }} +<button onclick="return flogit(this, 'react', '{{ .Honk.XID }}');">react</button> +{{ end }} </div> </details> <p>
M
web.go
→
web.go
@@ -1267,6 +1267,18 @@ }
return } + if wherefore == "react" { + xonk := getxonk(userinfo.UserID, what) + if xonk != nil { + _, err := stmtUpdateFlags.Exec(flagIsReacted, xonk.ID) + if err != nil { + log.Printf("error saving: %s", err) + } + sendzonkofsorts(xonk, user, "react") + } + return + } + // my hammer is too big, oh well defer oldjonks.Flush()