diff options
author | 2023-12-12 13:47:07 +0000 | |
---|---|---|
committer | 2023-12-12 13:47:07 +0000 | |
commit | ac481925622df9bf8024d1b5726282d0214fd22b (patch) | |
tree | debb07d995a352f8c34673c3bbfc1d71a17248ff /web/template | |
parent | [bugfix] ensure the 'Closing' flag doesn't get cached (#2443) (diff) | |
download | gotosocial-ac481925622df9bf8024d1b5726282d0214fd22b.tar.xz |
[bugfix] poll vote count fixes (#2444)
* don't drop all vote counts if hideCounts is set, refactors poll option extraction slightly
* omit voters_count when not set
* make voters_count a ptr to ensure it is omit unless definitely needed
* handle case of expires_at, voters_count and option.votes_count being nilable
* faster isNil check
* remove omitempty tags since mastodon API marks things as nullable but still sets them in outgoing json
Diffstat (limited to 'web/template')
-rw-r--r-- | web/template/status_poll.tmpl | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/web/template/status_poll.tmpl b/web/template/status_poll.tmpl index f6acecfa0..d26046283 100644 --- a/web/template/status_poll.tmpl +++ b/web/template/status_poll.tmpl @@ -47,6 +47,9 @@ <meter aria-hidden="true" id="poll-{{- $pollOption.PollID -}}-option-{{- increment $index -}}" min="0" max="100" value="{{- $pollOption.VoteShare -}}">{{- $pollOption.VoteShare -}}%</meter> <div class="sr-only">Option {{ increment $index }}: <span lang="{{ .LanguageTag.TagStr }}">{{ emojify .Emojis (noescape $pollOption.Title) -}}</span></div> <div class="poll-vote-summary"> + {{- if isNil $pollOption.VotesCount }} + Results not yet published. + {{- else -}} <span class="poll-vote-share">{{- $pollOption.VoteShareStr -}}%</span> <span class="poll-vote-count"> {{- if eq $pollOption.VotesCount 1 -}} @@ -55,6 +58,7 @@ {{- $pollOption.VotesCount }} votes {{- end -}} </span> + {{- end -}} </div> </li> {{- end }} |