Skip to content

Commit

Permalink
Fixed jumping to quoted messages in threads
Browse files Browse the repository at this point in the history
  • Loading branch information
martinmitrevski committed Nov 24, 2023
1 parent 7c2ddc7 commit d1a163b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 0 additions & 10 deletions Sources/StreamChatSwiftUI/Utils/MessageCachingUtils.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit d1a163b

Please sign in to comment.