Skip to content

Commit 5a7e399

Browse files
authored
Only show "Pin/Unpin message" Action if user has permission (#749)
1 parent 9854b64 commit 5a7e399

File tree

2 files changed

+24
-20
lines changed

2 files changed

+24
-20
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
55

66
### 🐞 Fixed
77
- Fix visibility of tabbar when reactions are shown [#750](https://github.com/GetStream/stream-chat-swiftui/pull/750)
8+
### 🔄 Changed
9+
- Only show "Pin/Unpin message" Action if user has permission [#749](https://github.com/GetStream/stream-chat-swiftui/pull/749)
810

911
# [4.72.0](https://github.com/GetStream/stream-chat-swiftui/releases/tag/4.72.0)
1012
_February 04, 2025_

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

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -88,26 +88,28 @@ public extension MessageAction {
8888
messageActions.append(replyThread)
8989
}
9090

91-
if message.pinDetails != nil {
92-
let unpinAction = unpinMessageAction(
93-
for: message,
94-
channel: channel,
95-
chatClient: chatClient,
96-
onFinish: onFinish,
97-
onError: onError
98-
)
99-
100-
messageActions.append(unpinAction)
101-
} else {
102-
let pinAction = pinMessageAction(
103-
for: message,
104-
channel: channel,
105-
chatClient: chatClient,
106-
onFinish: onFinish,
107-
onError: onError
108-
)
109-
110-
messageActions.append(pinAction)
91+
if channel.canPinMessage {
92+
if message.pinDetails != nil {
93+
let unpinAction = unpinMessageAction(
94+
for: message,
95+
channel: channel,
96+
chatClient: chatClient,
97+
onFinish: onFinish,
98+
onError: onError
99+
)
100+
101+
messageActions.append(unpinAction)
102+
} else {
103+
let pinAction = pinMessageAction(
104+
for: message,
105+
channel: channel,
106+
chatClient: chatClient,
107+
onFinish: onFinish,
108+
onError: onError
109+
)
110+
111+
messageActions.append(pinAction)
112+
}
111113
}
112114

113115
if !message.text.isEmpty {

0 commit comments

Comments
 (0)