forked from shadowfacts/Tusker
Poll own_votes is a nullable array of nullable ints, at least on pleroma
I do not understand why Closes #540
This commit is contained in:
parent
b7166771cf
commit
3f4917931b
|
@ -16,7 +16,7 @@ public struct Poll: Codable, Sendable {
|
||||||
public let votesCount: Int
|
public let votesCount: Int
|
||||||
public let votersCount: Int?
|
public let votersCount: Int?
|
||||||
public let voted: Bool?
|
public let voted: Bool?
|
||||||
public let ownVotes: [Int]?
|
public let ownVotes: [Int?]?
|
||||||
public let options: [Option]
|
public let options: [Option]
|
||||||
public let emojis: [Emoji]
|
public let emojis: [Emoji]
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ public struct Poll: Codable, Sendable {
|
||||||
self.votesCount = try container.decode(Int.self, forKey: .votesCount)
|
self.votesCount = try container.decode(Int.self, forKey: .votesCount)
|
||||||
self.votersCount = try container.decodeIfPresent(Int.self, forKey: .votersCount)
|
self.votersCount = try container.decodeIfPresent(Int.self, forKey: .votersCount)
|
||||||
self.voted = try container.decodeIfPresent(Bool.self, forKey: .voted)
|
self.voted = try container.decodeIfPresent(Bool.self, forKey: .voted)
|
||||||
self.ownVotes = try container.decodeIfPresent([Int].self, forKey: .ownVotes)
|
self.ownVotes = try container.decodeIfPresent([Int?].self, forKey: .ownVotes)
|
||||||
self.options = try container.decode([Poll.Option].self, forKey: .options)
|
self.options = try container.decode([Poll.Option].self, forKey: .options)
|
||||||
self.emojis = try container.decodeIfPresent([Emoji].self, forKey: .emojis) ?? []
|
self.emojis = try container.decodeIfPresent([Emoji].self, forKey: .emojis) ?? []
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue