Skip to content

Commit b1c5a2f

Browse files
authored
Fix thread reply action shown when inside a Thread (#717)
* Update CHANGELOG.md * Fix thread reply action shown when inside a Thread
1 parent 1295cff commit b1c5a2f

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
33

44
# Upcoming
55

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

89
# [4.70.0](https://github.com/GetStream/stream-chat-swiftui/releases/tag/4.70.0)
910
_January 15, 2025_

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

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,14 @@ public extension MessageAction {
7272
messageActions.append(replyAction)
7373
}
7474

75-
if channel.config.repliesEnabled && !message.isPartOfThread {
75+
// At the moment, this is the only way to know if we are inside a thread.
76+
// This should be optimised in the future and provide the view context.
77+
let messageController = InjectedValues[\.utils]
78+
.channelControllerFactory
79+
.makeMessageController(for: message.id, channelId: channel.cid)
80+
let isInsideThreadView = messageController.replies.count > 0
81+
82+
if channel.config.repliesEnabled && !message.isPartOfThread && !isInsideThreadView {
7683
let replyThread = threadReplyAction(
7784
factory: factory,
7885
for: message,
@@ -113,12 +120,6 @@ public extension MessageAction {
113120
}
114121

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

0 commit comments

Comments
 (0)