experimental reactions

Ted Unangst 4 years ago
parent e5dc29baaf
commit 88d55e5e35

@ -1152,6 +1152,13 @@ func jonkjonk(user *WhatAbout, h *Honk) (junk.Junk, junk.Junk) {
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)

@ -50,6 +50,9 @@ func userfromrow(row *sql.Row) (*WhatAbout, error) {
} else {
user.URL = fmt.Sprintf("https://%s/%s", serverName, user.Name)
}
if user.Options.Reaction == "" {
user.Options.Reaction = "😞"
}
return user, nil
}

@ -2,6 +2,8 @@ changelog
=== next
--- Add Reactions.
+ Quick fix to hide all images.
+ Allow resending follow requests.

@ -51,6 +51,7 @@ type UserOptions struct {
OmitImages bool `json:",omitempty"`
Avatar string `json:",omitempty"`
MapLink string `json:",omitempty"`
Reaction string `json:",omitempty"`
}
type KeyInfo struct {
@ -108,6 +109,7 @@ const (
flagIsBonked = 2
flagIsSaved = 4
flagIsUntagged = 8
flagIsReacted = 16
)
func (honk *Honk) IsAcked() bool {
@ -126,6 +128,10 @@ func (honk *Honk) IsUntagged() bool {
return honk.Flags&flagIsUntagged != 0
}
func (honk *Honk) IsReacted() bool {
return honk.Flags&flagIsReacted != 0
}
type Donk struct {
FileID int64
XID string

@ -121,6 +121,11 @@ in reply to: <a href="{{ .RID }}" rel=noreferrer>{{ .RID }}</a>
<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>

@ -1267,6 +1267,18 @@ func zonkit(w http.ResponseWriter, r *http.Request) {
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()

Loading…
Cancel
Save