From 4b436752af53e01cead2ed1c2c8a3daae95cdee6 Mon Sep 17 00:00:00 2001 From: JanNiklas Grabowski Date: Mon, 3 Jul 2023 15:27:36 +0200 Subject: [PATCH] MESSENGER-4929 show participant votes button when user has voted --- .../Modules/Room/TimelinePoll/TimelinePollModels.swift | 4 ++++ .../Modules/Room/TimelinePoll/View/TimelinePollView.swift | 3 +-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/RiotSwiftUI/Modules/Room/TimelinePoll/TimelinePollModels.swift b/RiotSwiftUI/Modules/Room/TimelinePoll/TimelinePollModels.swift index 3c4d06e96..ca31dbae7 100644 --- a/RiotSwiftUI/Modules/Room/TimelinePoll/TimelinePollModels.swift +++ b/RiotSwiftUI/Modules/Room/TimelinePoll/TimelinePollModels.swift @@ -100,6 +100,10 @@ struct TimelinePollDetails { var representsPollEndedEvent: Bool { eventType == .ended } + + var shouldShowShowParticipantsButton: Bool { + return (showParticipants && hasCurrentUserVoted && (type == TimelinePollType.disclosed || closed)) + } } extension TimelinePollDetails: Identifiable { } diff --git a/RiotSwiftUI/Modules/Room/TimelinePoll/View/TimelinePollView.swift b/RiotSwiftUI/Modules/Room/TimelinePoll/View/TimelinePollView.swift index dd69cc961..675e59ba5 100644 --- a/RiotSwiftUI/Modules/Room/TimelinePoll/View/TimelinePollView.swift +++ b/RiotSwiftUI/Modules/Room/TimelinePoll/View/TimelinePollView.swift @@ -74,8 +74,7 @@ struct TimelinePollView: View { .font(theme.fonts.footnote) .foregroundColor(theme.colors.tertiaryContent) - if poll.showParticipants && - (poll.type == TimelinePollType.disclosed || poll.closed) { + if poll.shouldShowShowParticipantsButton { Button(action: { viewModel.send(viewAction:.showParticipants) })