display actual reaction for the button label

This commit is contained in:
Ted Unangst 2020-04-19 20:10:40 -04:00
parent c0e1856f0e
commit 578e9c9351
3 changed files with 6 additions and 2 deletions

View File

@ -121,10 +121,12 @@ 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 not (eq .Badonk "none") }}
{{ if .Honk.IsReacted }}
<button disabled>badonked</button>
{{ else }}
<button onclick="return flogit(this, 'react', '{{ .Honk.XID }}');">badonk</button>
<button onclick="return flogit(this, 'react', '{{ .Honk.XID }}');">{{ .Badonk }}</button>
{{ end }}
{{ end }}
</div>
</details>

View File

@ -34,8 +34,9 @@ servermsgs[curpagestate.name + ":" + curpagestate.arg] = "{{ .ServerMessage }}"
{{ $BonkCSRF := .HonkCSRF }}
{{ $IsPreview := .IsPreview }}
{{ $MapLink := .MapLink }}
{{ $Badonk := .User.Options.Reaction }}
{{ range .Honks }}
{{ template "honk.html" map "Honk" . "MapLink" $MapLink "BonkCSRF" $BonkCSRF "IsPreview" $IsPreview }}
{{ template "honk.html" map "Honk" . "MapLink" $MapLink "BonkCSRF" $BonkCSRF "IsPreview" $IsPreview "Badonk" $Badonk }}
{{ end }}
</div>
</div>

1
web.go
View File

@ -1092,6 +1092,7 @@ func honkpage(w http.ResponseWriter, u *login.UserInfo, honks []*Honk, templinfo
var userid int64 = -1
if u != nil {
userid = u.UserID
templinfo["User"], _ = butwhatabout(u.Username)
}
reverbolate(userid, honks)
templinfo["Honks"] = honks