all repos — honk @ 632d67de95149254b5555336706e7f17ebf229be

my fork of honk

experimental reactions
Ted Unangst tedu@tedunangst.com
Thu, 23 Jan 2020 18:08:15 -0500
commit

632d67de95149254b5555336706e7f17ebf229be

parent

d9130fb386c0db5862b0210e6dd97c59edb10fe5

6 files changed, 35 insertions(+), 0 deletions(-)

jump to
M activity.goactivity.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.godatabase.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.txtdocs/changelog.txt

@@ -2,6 +2,8 @@ changelog

=== next +--- Add Reactions. + + Quick fix to hide all images. + Allow resending follow requests.
M honk.gohonk.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.htmlviews/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.goweb.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()