From f2e7675f2d0977ed086034e952980cc4fa0fb955 Mon Sep 17 00:00:00 2001 From: martinmitrevski Date: Mon, 24 Jun 2024 15:57:54 +0200 Subject: [PATCH 1/2] Fixed visibility of comments button for anon polls --- .../MessageList/Polls/PollAttachmentViewModel.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Sources/StreamChatSwiftUI/ChatChannel/MessageList/Polls/PollAttachmentViewModel.swift b/Sources/StreamChatSwiftUI/ChatChannel/MessageList/Polls/PollAttachmentViewModel.swift index e5669846..6165a366 100644 --- a/Sources/StreamChatSwiftUI/ChatChannel/MessageList/Polls/PollAttachmentViewModel.swift +++ b/Sources/StreamChatSwiftUI/ChatChannel/MessageList/Polls/PollAttachmentViewModel.swift @@ -85,11 +85,11 @@ public class PollAttachmentViewModel: ObservableObject, PollControllerDelegate { /// If true, add comment button is visible under votes, otherwise hidden. public var showAddCommentButton: Bool { + let addCommentAvailable = !poll.isClosed && poll.allowAnswers if poll.votingVisibility == .anonymous { - return true + return addCommentAvailable } - return !poll.isClosed - && poll.allowAnswers == true + return addCommentAvailable && ( poll.latestAnswers.filter { $0.user?.id == chatClient.currentUserId && $0.isAnswer From e47b90be1a2872d79c40a07d5ffad15291e59f1b Mon Sep 17 00:00:00 2001 From: martinmitrevski Date: Mon, 24 Jun 2024 17:01:43 +0200 Subject: [PATCH 2/2] Updated CHANGELOG --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 551057e1..d2d0fa89 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Dismiss the channel when leaving a group [#519](https://github.com/GetStream/stream-chat-swiftui/pull/519) - Dismiss keyboard when tapping on the empty message list [#513](https://github.com/GetStream/stream-chat-swiftui/pull/513) - 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) +- Visibility of the comments button in anonymous polls [#524](https://github.com/GetStream/stream-chat-swiftui/pull/524) ### 🔄 Changed - Show inline alert banner when encountering a failure while interacting with polls [#504](https://github.com/GetStream/stream-chat-swiftui/pull/504)