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

View File

@ -34,8 +34,9 @@ servermsgs[curpagestate.name + ":" + curpagestate.arg] = "{{ .ServerMessage }}"
{{ $BonkCSRF := .HonkCSRF }} {{ $BonkCSRF := .HonkCSRF }}
{{ $IsPreview := .IsPreview }} {{ $IsPreview := .IsPreview }}
{{ $MapLink := .MapLink }} {{ $MapLink := .MapLink }}
{{ $Badonk := .User.Options.Reaction }}
{{ range .Honks }} {{ 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 }} {{ end }}
</div> </div>
</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 var userid int64 = -1
if u != nil { if u != nil {
userid = u.UserID userid = u.UserID
templinfo["User"], _ = butwhatabout(u.Username)
} }
reverbolate(userid, honks) reverbolate(userid, honks)
templinfo["Honks"] = honks templinfo["Honks"] = honks