experimental reactions
This commit is contained in:
parent
506cc6ed34
commit
3c3f81e548
|
@ -1152,6 +1152,13 @@ func jonkjonk(user *WhatAbout, h *Honk) (junk.Junk, junk.Junk) {
|
||||||
if h.Convoy != "" {
|
if h.Convoy != "" {
|
||||||
j["context"] = 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":
|
case "deack":
|
||||||
b := junk.New()
|
b := junk.New()
|
||||||
b["id"] = user.URL + "/" + "ack" + "/" + shortxid(h.XID)
|
b["id"] = user.URL + "/" + "ack" + "/" + shortxid(h.XID)
|
||||||
|
|
|
@ -50,6 +50,9 @@ func userfromrow(row *sql.Row) (*WhatAbout, error) {
|
||||||
} else {
|
} else {
|
||||||
user.URL = fmt.Sprintf("https://%s/%s", serverName, user.Name)
|
user.URL = fmt.Sprintf("https://%s/%s", serverName, user.Name)
|
||||||
}
|
}
|
||||||
|
if user.Options.Reaction == "" {
|
||||||
|
user.Options.Reaction = "😞"
|
||||||
|
}
|
||||||
return user, nil
|
return user, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,8 @@ changelog
|
||||||
|
|
||||||
=== next
|
=== next
|
||||||
|
|
||||||
|
--- Add Reactions.
|
||||||
|
|
||||||
+ Quick fix to hide all images.
|
+ Quick fix to hide all images.
|
||||||
|
|
||||||
+ Allow resending follow requests.
|
+ Allow resending follow requests.
|
||||||
|
|
6
honk.go
6
honk.go
|
@ -51,6 +51,7 @@ type UserOptions struct {
|
||||||
OmitImages bool `json:",omitempty"`
|
OmitImages bool `json:",omitempty"`
|
||||||
Avatar string `json:",omitempty"`
|
Avatar string `json:",omitempty"`
|
||||||
MapLink string `json:",omitempty"`
|
MapLink string `json:",omitempty"`
|
||||||
|
Reaction string `json:",omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type KeyInfo struct {
|
type KeyInfo struct {
|
||||||
|
@ -108,6 +109,7 @@ const (
|
||||||
flagIsBonked = 2
|
flagIsBonked = 2
|
||||||
flagIsSaved = 4
|
flagIsSaved = 4
|
||||||
flagIsUntagged = 8
|
flagIsUntagged = 8
|
||||||
|
flagIsReacted = 16
|
||||||
)
|
)
|
||||||
|
|
||||||
func (honk *Honk) IsAcked() bool {
|
func (honk *Honk) IsAcked() bool {
|
||||||
|
@ -126,6 +128,10 @@ func (honk *Honk) IsUntagged() bool {
|
||||||
return honk.Flags&flagIsUntagged != 0
|
return honk.Flags&flagIsUntagged != 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (honk *Honk) IsReacted() bool {
|
||||||
|
return honk.Flags&flagIsReacted != 0
|
||||||
|
}
|
||||||
|
|
||||||
type Donk struct {
|
type Donk struct {
|
||||||
FileID int64
|
FileID int64
|
||||||
XID string
|
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>
|
<button onclick="return flogit(this, 'untag', '{{ .Honk.XID }}');">untag me</button>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
<button><a href="/edit?xid={{ .Honk.XID }}">edit</a></button>
|
<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>
|
</div>
|
||||||
</details>
|
</details>
|
||||||
<p>
|
<p>
|
||||||
|
|
12
web.go
12
web.go
|
@ -1267,6 +1267,18 @@ func zonkit(w http.ResponseWriter, r *http.Request) {
|
||||||
return
|
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
|
// my hammer is too big, oh well
|
||||||
defer oldjonks.Flush()
|
defer oldjonks.Flush()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue