fix(@desktop/appsearch): render mentions in app search module

fixes: #5423
This commit is contained in:
Patryk Osmaczko 2022-04-08 18:17:09 +02:00 committed by Iuri Matias
parent b6d10316d6
commit 0038501eb2
2 changed files with 7 additions and 2 deletions

View File

@ -153,3 +153,6 @@ proc resultItemClicked*(self: Controller, itemId: string) =
chatId: itemDetails.channelId,
messageId: itemDetails.messageId)
self.events.emit(SIGNAL_MAKE_SECTION_CHAT_ACTIVE, data)
proc getRenderedText*(self: Controller, parsedTextArray: seq[ParsedText]): string =
return self.messageService.getRenderedText(parsedTextArray)

View File

@ -209,13 +209,15 @@ method onSearchMessagesDone*(self: Module, messages: seq[MessageDto]) =
if(m.`from` == singletonInstance.userProfile.getPubKey()):
senderName = "You"
let renderedMessageText = self.controller.getRenderedText(m.parsedText)
if(chatDto.communityId.len == 0):
var chatName = chatDto.name
var chatImage = chatDto.icon
if(chatDto.chatType == ChatType.OneToOne):
(chatName, chatImage) = self.controller.getOneToOneChatNameAndImage(chatDto.id)
let item = result_item.initItem(m.id, m.text, $m.timestamp, m.`from`, senderName,
let item = result_item.initItem(m.id, renderedMessageText, $m.timestamp, m.`from`, senderName,
SEARCH_RESULT_MESSAGES_SECTION_NAME, senderImage, "", chatName, "", chatImage, chatDto.color, false)
self.controller.addResultItemDetails(m.id, singletonInstance.userProfile.getPubKey(),
@ -225,7 +227,7 @@ method onSearchMessagesDone*(self: Module, messages: seq[MessageDto]) =
let community = self.controller.getCommunityById(chatDto.communityId)
let channelName = "#" & chatDto.name
let item = result_item.initItem(m.id, m.text, $m.timestamp, m.`from`, senderName,
let item = result_item.initItem(m.id, renderedMessageText, $m.timestamp, m.`from`, senderName,
SEARCH_RESULT_MESSAGES_SECTION_NAME, senderImage, "", community.name, channelName, community.images.thumbnail,
community.color, false)