diff --git a/Sources/StreamChatSwiftUI/ChatChannel/ChatChannelViewModel.swift b/Sources/StreamChatSwiftUI/ChatChannel/ChatChannelViewModel.swift index b0830e33..81ec9d74 100644 --- a/Sources/StreamChatSwiftUI/ChatChannel/ChatChannelViewModel.swift +++ b/Sources/StreamChatSwiftUI/ChatChannel/ChatChannelViewModel.swift @@ -225,9 +225,15 @@ open class ChatChannelViewModel: ObservableObject, MessagesDataSource { } return true } else { - if messageCachingUtils.isQuotedMessage(with: messageId) && !isMessageThread { + let message = channelController.dataStore.message(id: baseId) + if let parentMessageId = message?.parentMessageId, !isMessageThread { + let parentMessage = channelController.dataStore.message(id: parentMessageId) + threadMessage = parentMessage + threadMessageShown = true + messageCachingUtils.jumpToReplyId = message?.messageId return false } + scrolledId = nil if loadingMessagesAround { return false diff --git a/Sources/StreamChatSwiftUI/Utils/MessageCachingUtils.swift b/Sources/StreamChatSwiftUI/Utils/MessageCachingUtils.swift index 294c6b2c..ce7a87d8 100644 --- a/Sources/StreamChatSwiftUI/Utils/MessageCachingUtils.swift +++ b/Sources/StreamChatSwiftUI/Utils/MessageCachingUtils.swift @@ -80,16 +80,6 @@ class MessageCachingUtils { return quoted } - - func isQuotedMessage(with id: String) -> Bool { - for (_, value) in quotedMessageMapping { - if value.messageId == id { - return true - } - } - - return false - } func userDisplayInfo(with id: String) -> UserDisplayInfo? { for userInfo in messageAuthors.values {