Skip to content

Commit ac6b1c9

Browse files
committed
Fix deprecated poll vote list query initializers
1 parent 58d8f90 commit ac6b1c9

File tree

3 files changed

+3
-9
lines changed

3 files changed

+3
-9
lines changed

Sources/StreamChatSwiftUI/ChatChannel/MessageList/Polls/PollCommentsViewModel.swift

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,7 @@ class PollCommentsViewModel: ObservableObject, PollVoteListControllerDelegate {
2525
convenience init(poll: Poll, pollController: PollController) {
2626
let query = PollVoteListQuery(
2727
pollId: poll.id,
28-
optionId: nil,
29-
filter: .and(
30-
[.equal(.pollId, to: poll.id), .equal(.isAnswer, to: true)]
31-
)
28+
filter: .equal(.isAnswer, to: true)
3229
)
3330
self.init(
3431
pollController: pollController,

Sources/StreamChatSwiftUI/ChatChannel/MessageList/Polls/PollOptionAllVotesViewModel.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class PollOptionAllVotesViewModel: ObservableObject, PollVoteListControllerDeleg
2424
self.option = option
2525
let query = PollVoteListQuery(
2626
pollId: poll.id,
27-
optionId: option.id, filter: .equal(.optionId, to: option.id)
27+
optionId: option.id
2828
)
2929
controller = InjectedValues[\.chatClient].pollVoteListController(query: query)
3030
controller.delegate = self

StreamChatSwiftUITests/Tests/ChatChannel/PollCommentsViewModel_Tests.swift

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,7 @@ final class PollCommentsViewModel_Tests: StreamChatTestCase {
8282
private func makeCommentsController() -> PollVoteListController_Mock {
8383
let query = PollVoteListQuery(
8484
pollId: .unique,
85-
optionId: nil,
86-
filter: .and(
87-
[.equal(.pollId, to: .unique), .equal(.isAnswer, to: true)]
88-
)
85+
filter: .equal(.isAnswer, to: true)
8986
)
9087
return PollVoteListController_Mock(query: query, client: chatClient)
9188
}

0 commit comments

Comments
 (0)