Skip to content

Commit

Permalink
Only show "Pin/Unpin message" Action if user has permission
Browse files Browse the repository at this point in the history
  • Loading branch information
sheep-q committed Feb 10, 2025
1 parent 554d52b commit 9b997a0
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 20 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
# Upcoming

### 🔄 Changed
- Only show "Pin/Unpin message" Action if user has permission [#749](https://github.com/GetStream/stream-chat-swiftui/pull/749)

# [4.72.0](https://github.com/GetStream/stream-chat-swiftui/releases/tag/4.72.0)
_February 04, 2025_
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,26 +88,28 @@ public extension MessageAction {
messageActions.append(replyThread)
}

if message.pinDetails != nil {
let unpinAction = unpinMessageAction(
for: message,
channel: channel,
chatClient: chatClient,
onFinish: onFinish,
onError: onError
)

messageActions.append(unpinAction)
} else {
let pinAction = pinMessageAction(
for: message,
channel: channel,
chatClient: chatClient,
onFinish: onFinish,
onError: onError
)

messageActions.append(pinAction)
if channel.canPinMessage {
if message.pinDetails != nil {
let unpinAction = unpinMessageAction(
for: message,
channel: channel,
chatClient: chatClient,
onFinish: onFinish,
onError: onError
)

messageActions.append(unpinAction)
} else {
let pinAction = pinMessageAction(
for: message,
channel: channel,
chatClient: chatClient,
onFinish: onFinish,
onError: onError
)

messageActions.append(pinAction)
}
}

if !message.text.isEmpty {
Expand Down

0 comments on commit 9b997a0

Please sign in to comment.