mirror of
https://github.com/superseriousbusiness/gotosocial
synced 2025-06-05 21:59:39 +02:00
[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
This commit is contained in:
@@ -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.
|
||||
|
Reference in New Issue
Block a user