Skip to content

Commit

Permalink
Fix thread reply action shown when inside a Thread (#717)
Browse files Browse the repository at this point in the history
* Update CHANGELOG.md

* Fix thread reply action shown when inside a Thread
  • Loading branch information
nuno-vieira authored Jan 16, 2025
1 parent 1295cff commit b1c5a2f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

# Upcoming

### 🔄 Changed
### 🐞 Fixed
- Fix thread reply action shown when inside a Thread [#717](https://github.com/GetStream/stream-chat-swiftui/pull/717)

# [4.70.0](https://github.com/GetStream/stream-chat-swiftui/releases/tag/4.70.0)
_January 15, 2025_
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,14 @@ public extension MessageAction {
messageActions.append(replyAction)
}

if channel.config.repliesEnabled && !message.isPartOfThread {
// At the moment, this is the only way to know if we are inside a thread.
// This should be optimised in the future and provide the view context.
let messageController = InjectedValues[\.utils]
.channelControllerFactory
.makeMessageController(for: message.id, channelId: channel.cid)
let isInsideThreadView = messageController.replies.count > 0

if channel.config.repliesEnabled && !message.isPartOfThread && !isInsideThreadView {
let replyThread = threadReplyAction(
factory: factory,
for: message,
Expand Down Expand Up @@ -113,12 +120,6 @@ public extension MessageAction {
}

if message.isRootOfThread {
let messageController = InjectedValues[\.utils]
.channelControllerFactory
.makeMessageController(for: message.id, channelId: channel.cid)
// At the moment, this is the only way to know if we are inside a thread.
// This should be optimised in the future and provide the view context.
let isInsideThreadView = messageController.replies.count > 0
if isInsideThreadView {
let markThreadUnreadAction = markThreadAsUnreadAction(
messageController: messageController,
Expand Down

0 comments on commit b1c5a2f

Please sign in to comment.