Skip to content

Commit 1cdd74e

Browse files
authored
Only show "Flag message" Action if user has permission (#599)
1 parent 23bdfd9 commit 1cdd74e

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
99
### 🔄 Changed
1010
- Improved subtitle info in pinned messages view [#594](https://github.com/GetStream/stream-chat-swiftui/pull/594)
1111
- The `image(for channel: ChatChannel)` in `ChannelHeaderLoader` is now open [#595](https://github.com/GetStream/stream-chat-swiftui/pull/595)
12+
- FlagMessage Action is now only shown if user has permission to perform action [#599](https://github.com/GetStream/stream-chat-swiftui/pull/599)
1213

1314
### 🐞 Fixed
1415
- Typing users did not update reliably in the message list [#591](https://github.com/GetStream/stream-chat-swiftui/pull/591)

Sources/StreamChatSwiftUI/ChatChannel/Reactions/MessageActions/DefaultMessageActions.swift

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -142,15 +142,17 @@ extension MessageAction {
142142
messageActions.append(markUnreadAction)
143143
}
144144

145-
let flagAction = flagMessageAction(
146-
for: message,
147-
channel: channel,
148-
chatClient: chatClient,
149-
onFinish: onFinish,
150-
onError: onError
151-
)
152-
153-
messageActions.append(flagAction)
145+
if channel.canFlagMessage {
146+
let flagAction = flagMessageAction(
147+
for: message,
148+
channel: channel,
149+
chatClient: chatClient,
150+
onFinish: onFinish,
151+
onError: onError
152+
)
153+
154+
messageActions.append(flagAction)
155+
}
154156

155157
if channel.config.mutesEnabled {
156158
let author = message.author

0 commit comments

Comments
 (0)