Skip to content

Commit 8ee90c0

Browse files
Fixed visibility of comments button for anon polls (#524)
1 parent 223a975 commit 8ee90c0

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
1010
- Dismiss the channel when leaving a group [#519](https://github.com/GetStream/stream-chat-swiftui/pull/519)
1111
- Dismiss keyboard when tapping on the empty message list [#513](https://github.com/GetStream/stream-chat-swiftui/pull/513)
1212
- Reset composer text when there is provisional text (e.g. Japanese - kana keyboard) but the text is reset to empty string [#512](https://github.com/GetStream/stream-chat-swiftui/pull/512)
13+
- Visibility of the comments button in anonymous polls [#524](https://github.com/GetStream/stream-chat-swiftui/pull/524)
1314

1415
### 🔄 Changed
1516
- Show inline alert banner when encountering a failure while interacting with polls [#504](https://github.com/GetStream/stream-chat-swiftui/pull/504)

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,11 @@ public class PollAttachmentViewModel: ObservableObject, PollControllerDelegate {
8585

8686
/// If true, add comment button is visible under votes, otherwise hidden.
8787
public var showAddCommentButton: Bool {
88+
let addCommentAvailable = !poll.isClosed && poll.allowAnswers
8889
if poll.votingVisibility == .anonymous {
89-
return true
90+
return addCommentAvailable
9091
}
91-
return !poll.isClosed
92-
&& poll.allowAnswers == true
92+
return addCommentAvailable
9393
&& (
9494
poll.latestAnswers.filter {
9595
$0.user?.id == chatClient.currentUserId && $0.isAnswer

0 commit comments

Comments
 (0)