diff options
author | 2023-12-12 13:47:07 +0000 | |
---|---|---|
committer | 2023-12-12 13:47:07 +0000 | |
commit | ac481925622df9bf8024d1b5726282d0214fd22b (patch) | |
tree | debb07d995a352f8c34673c3bbfc1d71a17248ff /internal/api | |
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 'internal/api')
-rw-r--r-- | internal/api/model/poll.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/internal/api/model/poll.go b/internal/api/model/poll.go index 3eb801998..5603ff222 100644 --- a/internal/api/model/poll.go +++ b/internal/api/model/poll.go @@ -28,7 +28,7 @@ type Poll struct { ID string `json:"id"` // When the poll ends. (ISO 8601 Datetime). - ExpiresAt string `json:"expires_at"` + ExpiresAt *string `json:"expires_at"` // Is the poll currently expired? Expired bool `json:"expired"` @@ -40,7 +40,7 @@ type Poll struct { VotesCount int `json:"votes_count"` // How many unique accounts have voted on a multiple-choice poll. - VotersCount int `json:"voters_count"` + VotersCount *int `json:"voters_count"` // When called with a user token, has the authorized user voted? // @@ -68,7 +68,7 @@ type PollOption struct { Title string `json:"title"` // The number of received votes for this option. - VotesCount int `json:"votes_count"` + VotesCount *int `json:"votes_count"` } // PollRequest models a request to create a poll. |