From ac481925622df9bf8024d1b5726282d0214fd22b Mon Sep 17 00:00:00 2001 From: kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com> Date: Tue, 12 Dec 2023 13:47:07 +0000 Subject: [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 --- web/template/status_poll.tmpl | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'web/template') 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 @@
Option {{ increment $index }}: {{ emojify .Emojis (noescape $pollOption.Title) -}}
+ {{- if isNil $pollOption.VotesCount }} + Results not yet published. + {{- else -}} {{- $pollOption.VoteShareStr -}}% {{- if eq $pollOption.VotesCount 1 -}} @@ -55,6 +58,7 @@ {{- $pollOption.VotesCount }} votes {{- end -}} + {{- end -}}
{{- end }} -- cgit v1.2.3