fix(chat): only turn available channels into clickable tags
Closes #8895
This commit is contained in:
parent
342d79e21c
commit
979b035049
|
@ -6,6 +6,7 @@ import ../../../core/eventemitter
|
||||||
import ../../../../app_service/service/activity_center/service as activity_center_service
|
import ../../../../app_service/service/activity_center/service as activity_center_service
|
||||||
import ../../../../app_service/service/contacts/service as contacts_service
|
import ../../../../app_service/service/contacts/service as contacts_service
|
||||||
import ../../../../app_service/service/message/service as message_service
|
import ../../../../app_service/service/message/service as message_service
|
||||||
|
import ../../../../app_service/service/community/service as community_service
|
||||||
import ../../../../app_service/service/eth/utils as eth_utils
|
import ../../../../app_service/service/eth/utils as eth_utils
|
||||||
import ../../../../app_service/service/chat/service as chat_service
|
import ../../../../app_service/service/chat/service as chat_service
|
||||||
|
|
||||||
|
@ -17,6 +18,7 @@ type
|
||||||
contactsService: contacts_service.Service
|
contactsService: contacts_service.Service
|
||||||
messageService: message_service.Service
|
messageService: message_service.Service
|
||||||
chatService: chat_service.Service
|
chatService: chat_service.Service
|
||||||
|
communityService: community_service.Service
|
||||||
|
|
||||||
proc newController*(
|
proc newController*(
|
||||||
delegate: io_interface.AccessInterface,
|
delegate: io_interface.AccessInterface,
|
||||||
|
@ -24,7 +26,8 @@ proc newController*(
|
||||||
activityCenterService: activity_center_service.Service,
|
activityCenterService: activity_center_service.Service,
|
||||||
contactsService: contacts_service.Service,
|
contactsService: contacts_service.Service,
|
||||||
messageService: message_service.Service,
|
messageService: message_service.Service,
|
||||||
chatService: chat_service.Service
|
chatService: chat_service.Service,
|
||||||
|
communityService: community_service.Service,
|
||||||
): Controller =
|
): Controller =
|
||||||
result = Controller()
|
result = Controller()
|
||||||
result.delegate = delegate
|
result.delegate = delegate
|
||||||
|
@ -33,6 +36,7 @@ proc newController*(
|
||||||
result.contactsService = contactsService
|
result.contactsService = contactsService
|
||||||
result.messageService = messageService
|
result.messageService = messageService
|
||||||
result.chatService = chatService
|
result.chatService = chatService
|
||||||
|
result.communityService = communityService
|
||||||
|
|
||||||
proc delete*(self: Controller) =
|
proc delete*(self: Controller) =
|
||||||
discard
|
discard
|
||||||
|
@ -73,6 +77,9 @@ proc unreadActivityCenterNotificationsCount*(self: Controller): int =
|
||||||
proc getContactDetails*(self: Controller, contactId: string): ContactDetails =
|
proc getContactDetails*(self: Controller, contactId: string): ContactDetails =
|
||||||
return self.contactsService.getContactDetails(contactId)
|
return self.contactsService.getContactDetails(contactId)
|
||||||
|
|
||||||
|
proc getCommunityById*(self: Controller, communityId: string): CommunityDto =
|
||||||
|
return self.communityService.getCommunityById(communityId)
|
||||||
|
|
||||||
proc getActivityCenterNotifications*(self: Controller): seq[ActivityCenterNotificationDto] =
|
proc getActivityCenterNotifications*(self: Controller): seq[ActivityCenterNotificationDto] =
|
||||||
return self.activityCenterService.getActivityCenterNotifications()
|
return self.activityCenterService.getActivityCenterNotifications()
|
||||||
|
|
||||||
|
@ -99,8 +106,8 @@ proc acceptActivityCenterNotifications*(self: Controller, notificationIds: seq[s
|
||||||
proc dismissActivityCenterNotifications*(self: Controller, notificationIds: seq[string]): string =
|
proc dismissActivityCenterNotifications*(self: Controller, notificationIds: seq[string]): string =
|
||||||
return self.activityCenterService.dismissActivityCenterNotifications(notificationIds)
|
return self.activityCenterService.dismissActivityCenterNotifications(notificationIds)
|
||||||
|
|
||||||
proc getRenderedText*(self: Controller, parsedTextArray: seq[ParsedText]): string =
|
proc getRenderedText*(self: Controller, parsedTextArray: seq[ParsedText], communityChats: seq[ChatDto]): string =
|
||||||
return self.messageService.getRenderedText(parsedTextArray)
|
return self.messageService.getRenderedText(parsedTextArray, communityChats)
|
||||||
|
|
||||||
proc switchTo*(self: Controller, sectionId, chatId, messageId: string) =
|
proc switchTo*(self: Controller, sectionId, chatId, messageId: string) =
|
||||||
let data = ActiveSectionChatArgs(sectionId: sectionId, chatId: chatId, messageId: messageId)
|
let data = ActiveSectionChatArgs(sectionId: sectionId, chatId: chatId, messageId: messageId)
|
||||||
|
|
|
@ -12,6 +12,7 @@ import ../../../../app_service/service/activity_center/service as activity_cente
|
||||||
import ../../../../app_service/service/contacts/service as contacts_service
|
import ../../../../app_service/service/contacts/service as contacts_service
|
||||||
import ../../../../app_service/service/message/service as message_service
|
import ../../../../app_service/service/message/service as message_service
|
||||||
import ../../../../app_service/service/chat/service as chat_service
|
import ../../../../app_service/service/chat/service as chat_service
|
||||||
|
import ../../../../app_service/service/community/service as community_service
|
||||||
|
|
||||||
import ../../../global/app_sections_config as conf
|
import ../../../global/app_sections_config as conf
|
||||||
|
|
||||||
|
@ -31,7 +32,8 @@ proc newModule*(
|
||||||
activityCenterService: activity_center_service.Service,
|
activityCenterService: activity_center_service.Service,
|
||||||
contactsService: contacts_service.Service,
|
contactsService: contacts_service.Service,
|
||||||
messageService: message_service.Service,
|
messageService: message_service.Service,
|
||||||
chatService: chat_service.Service
|
chatService: chat_service.Service,
|
||||||
|
communityService: community_service.Service
|
||||||
): Module =
|
): Module =
|
||||||
result = Module()
|
result = Module()
|
||||||
result.delegate = delegate
|
result.delegate = delegate
|
||||||
|
@ -43,7 +45,8 @@ proc newModule*(
|
||||||
activityCenterService,
|
activityCenterService,
|
||||||
contactsService,
|
contactsService,
|
||||||
messageService,
|
messageService,
|
||||||
chatService
|
chatService,
|
||||||
|
communityService
|
||||||
)
|
)
|
||||||
result.moduleLoaded = false
|
result.moduleLoaded = false
|
||||||
|
|
||||||
|
@ -70,6 +73,8 @@ method unreadActivityCenterNotificationsCount*(self: Module): int =
|
||||||
|
|
||||||
proc createMessageItemFromDto(self: Module, message: MessageDto, chatDetails: ChatDto): MessageItem =
|
proc createMessageItemFromDto(self: Module, message: MessageDto, chatDetails: ChatDto): MessageItem =
|
||||||
let contactDetails = self.controller.getContactDetails(message.`from`)
|
let contactDetails = self.controller.getContactDetails(message.`from`)
|
||||||
|
let communityChats = self.controller.getCommunityById(chatDetails.communityId).chats
|
||||||
|
|
||||||
return msg_item_qobj.newMessageItem(msg_item.initItem(
|
return msg_item_qobj.newMessageItem(msg_item.initItem(
|
||||||
message.id,
|
message.id,
|
||||||
chatDetails.communityId, # we don't received community id via `activityCenterNotifications` api call
|
chatDetails.communityId, # we don't received community id via `activityCenterNotifications` api call
|
||||||
|
@ -81,7 +86,7 @@ proc createMessageItemFromDto(self: Module, message: MessageDto, chatDetails: Ch
|
||||||
contactDetails.isCurrentUser,
|
contactDetails.isCurrentUser,
|
||||||
contactDetails.details.added,
|
contactDetails.details.added,
|
||||||
message.outgoingStatus,
|
message.outgoingStatus,
|
||||||
self.controller.getRenderedText(message.parsedText),
|
self.controller.getRenderedText(message.parsedText, communityChats),
|
||||||
message.text,
|
message.text,
|
||||||
message.image,
|
message.image,
|
||||||
message.containsContactMentions(),
|
message.containsContactMentions(),
|
||||||
|
@ -103,7 +108,7 @@ proc createMessageItemFromDto(self: Module, message: MessageDto, chatDetails: Ch
|
||||||
message.mentioned,
|
message.mentioned,
|
||||||
message.quotedMessage.`from`,
|
message.quotedMessage.`from`,
|
||||||
message.quotedMessage.text,
|
message.quotedMessage.text,
|
||||||
self.controller.getRenderedText( message.quotedMessage.parsedText),
|
self.controller.getRenderedText(message.quotedMessage.parsedText, communityChats),
|
||||||
message.quotedMessage.contentType,
|
message.quotedMessage.contentType,
|
||||||
message.quotedMessage.deleted,
|
message.quotedMessage.deleted,
|
||||||
message.quotedMessage.discordMessage,
|
message.quotedMessage.discordMessage,
|
||||||
|
|
|
@ -156,8 +156,8 @@ proc resultItemClicked*(self: Controller, itemId: string) =
|
||||||
messageId: itemDetails.messageId)
|
messageId: itemDetails.messageId)
|
||||||
self.events.emit(SIGNAL_MAKE_SECTION_CHAT_ACTIVE, data)
|
self.events.emit(SIGNAL_MAKE_SECTION_CHAT_ACTIVE, data)
|
||||||
|
|
||||||
proc getRenderedText*(self: Controller, parsedTextArray: seq[ParsedText]): string =
|
proc getRenderedText*(self: Controller, parsedTextArray: seq[ParsedText], communityChats: seq[ChatDto]): string =
|
||||||
return self.messageService.getRenderedText(parsedTextArray)
|
return self.messageService.getRenderedText(parsedTextArray, communityChats)
|
||||||
|
|
||||||
proc getColorHash*(self: Controller, pubkey: string): ColorHashDto =
|
proc getColorHash*(self: Controller, pubkey: string): ColorHashDto =
|
||||||
procs_from_visual_identity_service.colorHashOf(pubkey)
|
procs_from_visual_identity_service.colorHashOf(pubkey)
|
||||||
|
|
|
@ -236,7 +236,9 @@ method onSearchMessagesDone*(self: Module, messages: seq[MessageDto]) =
|
||||||
if(m.`from` == singletonInstance.userProfile.getPubKey()):
|
if(m.`from` == singletonInstance.userProfile.getPubKey()):
|
||||||
senderName = "You"
|
senderName = "You"
|
||||||
|
|
||||||
let renderedMessageText = self.controller.getRenderedText(m.parsedText)
|
let communityChats = self.controller.getCommunityById(chatDto.communityId).chats
|
||||||
|
|
||||||
|
let renderedMessageText = self.controller.getRenderedText(m.parsedText, communityChats)
|
||||||
let colorHash = self.controller.getColorHash(m.`from`)
|
let colorHash = self.controller.getColorHash(m.`from`)
|
||||||
let colorId = self.controller.getColorId(m.`from`)
|
let colorId = self.controller.getColorId(m.`from`)
|
||||||
|
|
||||||
|
|
|
@ -189,6 +189,9 @@ proc getChatDetails*(self: Controller): ChatDto =
|
||||||
proc getCommunityDetails*(self: Controller): CommunityDto =
|
proc getCommunityDetails*(self: Controller): CommunityDto =
|
||||||
return self.communityService.getCommunityById(self.sectionId)
|
return self.communityService.getCommunityById(self.sectionId)
|
||||||
|
|
||||||
|
proc getCommunityById*(self: Controller, communityId: string): CommunityDto =
|
||||||
|
return self.communityService.getCommunityById(communityId)
|
||||||
|
|
||||||
proc getOneToOneChatNameAndImage*(self: Controller): tuple[name: string, image: string, largeImage: string] =
|
proc getOneToOneChatNameAndImage*(self: Controller): tuple[name: string, image: string, largeImage: string] =
|
||||||
return self.chatService.getOneToOneChatNameAndImage(self.chatId)
|
return self.chatService.getOneToOneChatNameAndImage(self.chatId)
|
||||||
|
|
||||||
|
@ -235,8 +238,8 @@ proc getContactDetails*(self: Controller, contactId: string): ContactDetails =
|
||||||
proc getCurrentFleet*(self: Controller): string =
|
proc getCurrentFleet*(self: Controller): string =
|
||||||
return self.nodeConfigurationService.getFleetAsString()
|
return self.nodeConfigurationService.getFleetAsString()
|
||||||
|
|
||||||
proc getRenderedText*(self: Controller, parsedTextArray: seq[ParsedText]): string =
|
proc getRenderedText*(self: Controller, parsedTextArray: seq[ParsedText], communityChats: seq[ChatDto]): string =
|
||||||
return self.messageService.getRenderedText(parsedTextArray)
|
return self.messageService.getRenderedText(parsedTextArray, communityChats)
|
||||||
|
|
||||||
proc getTransactionDetails*(self: Controller, message: MessageDto): (string,string) =
|
proc getTransactionDetails*(self: Controller, message: MessageDto): (string,string) =
|
||||||
return self.messageService.getTransactionDetails(message)
|
return self.messageService.getTransactionDetails(message)
|
||||||
|
|
|
@ -222,6 +222,9 @@ proc getChatDetails*(self: Controller): ChatDto =
|
||||||
proc getCommunityDetails*(self: Controller): CommunityDto =
|
proc getCommunityDetails*(self: Controller): CommunityDto =
|
||||||
return self.communityService.getCommunityById(self.sectionId)
|
return self.communityService.getCommunityById(self.sectionId)
|
||||||
|
|
||||||
|
proc getCommunityById*(self: Controller, communityId: string): CommunityDto =
|
||||||
|
return self.communityService.getCommunityById(communityId)
|
||||||
|
|
||||||
proc getOneToOneChatNameAndImage*(self: Controller):
|
proc getOneToOneChatNameAndImage*(self: Controller):
|
||||||
tuple[name: string, image: string, largeImage: string] =
|
tuple[name: string, image: string, largeImage: string] =
|
||||||
return self.chatService.getOneToOneChatNameAndImage(self.chatId)
|
return self.chatService.getOneToOneChatNameAndImage(self.chatId)
|
||||||
|
@ -251,8 +254,8 @@ proc getContactDetails*(self: Controller, contactId: string): ContactDetails =
|
||||||
proc getNumOfPinnedMessages*(self: Controller): int =
|
proc getNumOfPinnedMessages*(self: Controller): int =
|
||||||
return self.messageService.getNumOfPinnedMessages(self.chatId)
|
return self.messageService.getNumOfPinnedMessages(self.chatId)
|
||||||
|
|
||||||
proc getRenderedText*(self: Controller, parsedTextArray: seq[ParsedText]): string =
|
proc getRenderedText*(self: Controller, parsedTextArray: seq[ParsedText], communityChats: seq[ChatDto]): string =
|
||||||
return self.messageService.getRenderedText(parsedTextArray)
|
return self.messageService.getRenderedText(parsedTextArray, communityChats)
|
||||||
|
|
||||||
proc getMessageDetails*(self: Controller, messageId: string):
|
proc getMessageDetails*(self: Controller, messageId: string):
|
||||||
tuple[message: MessageDto, reactions: seq[ReactionDto], error: string] =
|
tuple[message: MessageDto, reactions: seq[ReactionDto], error: string] =
|
||||||
|
|
|
@ -201,8 +201,10 @@ method newMessagesLoaded*(self: Module, messages: seq[MessageDto], reactions: se
|
||||||
continue
|
continue
|
||||||
|
|
||||||
let sender = self.controller.getContactDetails(message.`from`)
|
let sender = self.controller.getContactDetails(message.`from`)
|
||||||
|
let chatDetails = self.controller.getChatDetails()
|
||||||
|
let communityChats = self.controller.getCommunityById(chatDetails.communityId).chats
|
||||||
|
|
||||||
let renderedMessageText = self.controller.getRenderedText(message.parsedText)
|
let renderedMessageText = self.controller.getRenderedText(message.parsedText, communityChats)
|
||||||
var transactionContract = message.transactionParameters.contract
|
var transactionContract = message.transactionParameters.contract
|
||||||
var transactionValue = message.transactionParameters.value
|
var transactionValue = message.transactionParameters.value
|
||||||
var isCurrentUser = sender.isCurrentUser
|
var isCurrentUser = sender.isCurrentUser
|
||||||
|
@ -250,7 +252,7 @@ method newMessagesLoaded*(self: Module, messages: seq[MessageDto], reactions: se
|
||||||
message.mentioned,
|
message.mentioned,
|
||||||
message.quotedMessage.`from`,
|
message.quotedMessage.`from`,
|
||||||
message.quotedMessage.text,
|
message.quotedMessage.text,
|
||||||
self.controller.getRenderedText(message.quotedMessage.parsedText),
|
self.controller.getRenderedText(message.quotedMessage.parsedText, communityChats),
|
||||||
message.quotedMessage.contentType,
|
message.quotedMessage.contentType,
|
||||||
message.quotedMessage.deleted,
|
message.quotedMessage.deleted,
|
||||||
message.quotedMessage.discordMessage,
|
message.quotedMessage.discordMessage,
|
||||||
|
@ -301,8 +303,10 @@ method messagesAdded*(self: Module, messages: seq[MessageDto]) =
|
||||||
|
|
||||||
for message in messages:
|
for message in messages:
|
||||||
let sender = self.controller.getContactDetails(message.`from`)
|
let sender = self.controller.getContactDetails(message.`from`)
|
||||||
|
let chatDetails = self.controller.getChatDetails()
|
||||||
|
let communityChats = self.controller.getCommunityById(chatDetails.communityId).chats
|
||||||
|
|
||||||
let renderedMessageText = self.controller.getRenderedText(message.parsedText)
|
let renderedMessageText = self.controller.getRenderedText(message.parsedText, communityChats)
|
||||||
|
|
||||||
var transactionContract = message.transactionParameters.contract
|
var transactionContract = message.transactionParameters.contract
|
||||||
var transactionValue = message.transactionParameters.value
|
var transactionValue = message.transactionParameters.value
|
||||||
|
@ -361,12 +365,11 @@ method messagesAdded*(self: Module, messages: seq[MessageDto]) =
|
||||||
message.mentioned,
|
message.mentioned,
|
||||||
message.quotedMessage.`from`,
|
message.quotedMessage.`from`,
|
||||||
message.quotedMessage.text,
|
message.quotedMessage.text,
|
||||||
self.controller.getRenderedText(message.quotedMessage.parsedText),
|
self.controller.getRenderedText(message.quotedMessage.parsedText, communityChats),
|
||||||
message.quotedMessage.contentType,
|
message.quotedMessage.contentType,
|
||||||
message.quotedMessage.deleted,
|
message.quotedMessage.deleted,
|
||||||
message.quotedMessage.discordMessage,
|
message.quotedMessage.discordMessage,
|
||||||
)
|
)
|
||||||
|
|
||||||
items.add(item)
|
items.add(item)
|
||||||
|
|
||||||
self.view.model().insertItemsBasedOnClock(items)
|
self.view.model().insertItemsBasedOnClock(items)
|
||||||
|
@ -502,7 +505,9 @@ method updateContactDetails*(self: Module, contactId: string) =
|
||||||
if(item.messageContainsMentions):
|
if(item.messageContainsMentions):
|
||||||
let (message, _, err) = self.controller.getMessageDetails(item.id)
|
let (message, _, err) = self.controller.getMessageDetails(item.id)
|
||||||
if(err.len == 0):
|
if(err.len == 0):
|
||||||
item.messageText = self.controller.getRenderedText(message.parsedText)
|
let chatDetails = self.controller.getChatDetails()
|
||||||
|
let communityChats = self.controller.getCommunityById(chatDetails.communityId).chats
|
||||||
|
item.messageText = self.controller.getRenderedText(message.parsedText, communityChats)
|
||||||
item.messageContainsMentions = message.containsContactMentions()
|
item.messageContainsMentions = message.containsContactMentions()
|
||||||
|
|
||||||
method deleteMessage*(self: Module, messageId: string) =
|
method deleteMessage*(self: Module, messageId: string) =
|
||||||
|
@ -520,10 +525,12 @@ method onMessageEdited*(self: Module, message: MessageDto) =
|
||||||
return
|
return
|
||||||
|
|
||||||
let mentionedUsersPks = itemBeforeChange.mentionedUsersPks
|
let mentionedUsersPks = itemBeforeChange.mentionedUsersPks
|
||||||
|
let chatDetails = self.controller.getChatDetails()
|
||||||
|
let communityChats = self.controller.getCommunityById(chatDetails.communityId).chats
|
||||||
|
|
||||||
self.view.model().updateEditedMsg(
|
self.view.model().updateEditedMsg(
|
||||||
message.id,
|
message.id,
|
||||||
self.controller.getRenderedText(message.parsedText),
|
self.controller.getRenderedText(message.parsedText, communityChats),
|
||||||
message.text,
|
message.text,
|
||||||
message.contentType,
|
message.contentType,
|
||||||
message.containsContactMentions(),
|
message.containsContactMentions(),
|
||||||
|
@ -604,8 +611,10 @@ method getMessageById*(self: Module, messageId: string): message_item.Item =
|
||||||
let (message, _, err) = self.controller.getMessageDetails(messageId)
|
let (message, _, err) = self.controller.getMessageDetails(messageId)
|
||||||
if(err.len == 0):
|
if(err.len == 0):
|
||||||
let sender = self.controller.getContactDetails(message.`from`)
|
let sender = self.controller.getContactDetails(message.`from`)
|
||||||
|
let chatDetails = self.controller.getChatDetails()
|
||||||
|
let communityChats = self.controller.getCommunityById(chatDetails.communityId).chats
|
||||||
|
|
||||||
let renderedMessageText = self.controller.getRenderedText(message.parsedText)
|
let renderedMessageText = self.controller.getRenderedText(message.parsedText, communityChats)
|
||||||
var transactionContract = message.transactionParameters.contract
|
var transactionContract = message.transactionParameters.contract
|
||||||
var transactionValue = message.transactionParameters.value
|
var transactionValue = message.transactionParameters.value
|
||||||
var isCurrentUser = sender.isCurrentUser
|
var isCurrentUser = sender.isCurrentUser
|
||||||
|
@ -653,7 +662,7 @@ method getMessageById*(self: Module, messageId: string): message_item.Item =
|
||||||
message.mentioned,
|
message.mentioned,
|
||||||
message.quotedMessage.`from`,
|
message.quotedMessage.`from`,
|
||||||
message.quotedMessage.text,
|
message.quotedMessage.text,
|
||||||
self.controller.getRenderedText(message.quotedMessage.parsedText),
|
self.controller.getRenderedText(message.quotedMessage.parsedText, communityChats),
|
||||||
message.quotedMessage.contentType,
|
message.quotedMessage.contentType,
|
||||||
message.quotedMessage.deleted,
|
message.quotedMessage.deleted,
|
||||||
message.quotedMessage.discordMessage
|
message.quotedMessage.discordMessage
|
||||||
|
|
|
@ -155,6 +155,8 @@ proc buildPinnedMessageItem(self: Module, messageId: string, actionInitiatedBy:
|
||||||
return false
|
return false
|
||||||
|
|
||||||
let contactDetails = self.controller.getContactDetails(message.`from`)
|
let contactDetails = self.controller.getContactDetails(message.`from`)
|
||||||
|
let chatDetails = self.controller.getChatDetails()
|
||||||
|
let communityChats = self.controller.getCommunityById(chatDetails.communityId).chats
|
||||||
|
|
||||||
var transactionContract = message.transactionParameters.contract
|
var transactionContract = message.transactionParameters.contract
|
||||||
var transactionValue = message.transactionParameters.value
|
var transactionValue = message.transactionParameters.value
|
||||||
|
@ -174,7 +176,7 @@ proc buildPinnedMessageItem(self: Module, messageId: string, actionInitiatedBy:
|
||||||
isCurrentUser,
|
isCurrentUser,
|
||||||
contactDetails.details.added,
|
contactDetails.details.added,
|
||||||
message.outgoingStatus,
|
message.outgoingStatus,
|
||||||
self.controller.getRenderedText(message.parsedText),
|
self.controller.getRenderedText(message.parsedText, communityChats),
|
||||||
message.text,
|
message.text,
|
||||||
message.image,
|
message.image,
|
||||||
message.containsContactMentions(),
|
message.containsContactMentions(),
|
||||||
|
@ -203,7 +205,7 @@ proc buildPinnedMessageItem(self: Module, messageId: string, actionInitiatedBy:
|
||||||
message.mentioned,
|
message.mentioned,
|
||||||
message.quotedMessage.`from`,
|
message.quotedMessage.`from`,
|
||||||
message.quotedMessage.text,
|
message.quotedMessage.text,
|
||||||
self.controller.getRenderedText(message.quotedMessage.parsedText),
|
self.controller.getRenderedText(message.quotedMessage.parsedText, communityChats),
|
||||||
message.quotedMessage.contentType,
|
message.quotedMessage.contentType,
|
||||||
message.quotedMessage.deleted,
|
message.quotedMessage.deleted,
|
||||||
message.quotedMessage.discordMessage,
|
message.quotedMessage.discordMessage,
|
||||||
|
@ -340,7 +342,9 @@ method onContactDetailsUpdated*(self: Module, contactId: string) =
|
||||||
if(item.messageContainsMentions):
|
if(item.messageContainsMentions):
|
||||||
let (message, _, err) = self.controller.getMessageDetails(item.id)
|
let (message, _, err) = self.controller.getMessageDetails(item.id)
|
||||||
if(err.len == 0):
|
if(err.len == 0):
|
||||||
item.messageText = self.controller.getRenderedText(message.parsedText)
|
let chatDetails = self.controller.getChatDetails()
|
||||||
|
let communityChats = self.controller.getCommunityById(chatDetails.communityId).chats
|
||||||
|
item.messageText = self.controller.getRenderedText(message.parsedText, communityChats)
|
||||||
item.messageContainsMentions = message.containsContactMentions()
|
item.messageContainsMentions = message.containsContactMentions()
|
||||||
|
|
||||||
if(self.controller.getMyChatId() == contactId):
|
if(self.controller.getMyChatId() == contactId):
|
||||||
|
|
|
@ -253,6 +253,9 @@ proc isCommunity*(self: Controller): bool =
|
||||||
proc getMyCommunity*(self: Controller): CommunityDto =
|
proc getMyCommunity*(self: Controller): CommunityDto =
|
||||||
return self.communityService.getCommunityById(self.sectionId)
|
return self.communityService.getCommunityById(self.sectionId)
|
||||||
|
|
||||||
|
proc getCommunityById*(self: Controller, communityId: string): CommunityDto =
|
||||||
|
return self.communityService.getCommunityById(communityId)
|
||||||
|
|
||||||
proc getCategories*(self: Controller, communityId: string): seq[Category] =
|
proc getCategories*(self: Controller, communityId: string): seq[Category] =
|
||||||
return self.communityService.getCategories(communityId)
|
return self.communityService.getCategories(communityId)
|
||||||
|
|
||||||
|
@ -486,8 +489,8 @@ proc reorderCommunityCategories*(self: Controller, categoryId: string, position:
|
||||||
proc reorderCommunityChat*(self: Controller, categoryId: string, chatId: string, position: int): string =
|
proc reorderCommunityChat*(self: Controller, categoryId: string, chatId: string, position: int): string =
|
||||||
self.communityService.reorderCommunityChat(self.sectionId, categoryId, chatId, position)
|
self.communityService.reorderCommunityChat(self.sectionId, categoryId, chatId, position)
|
||||||
|
|
||||||
proc getRenderedText*(self: Controller, parsedTextArray: seq[ParsedText]): string =
|
proc getRenderedText*(self: Controller, parsedTextArray: seq[ParsedText], communityChats: seq[ChatDto]): string =
|
||||||
return self.messageService.getRenderedText(parsedTextArray)
|
return self.messageService.getRenderedText(parsedTextArray, communityChats)
|
||||||
|
|
||||||
proc getColorHash*(self: Controller, pubkey: string): ColorHashDto =
|
proc getColorHash*(self: Controller, pubkey: string): ColorHashDto =
|
||||||
procs_from_visual_identity_service.colorHashOf(pubkey)
|
procs_from_visual_identity_service.colorHashOf(pubkey)
|
||||||
|
|
|
@ -771,7 +771,8 @@ method onNewMessagesReceived*(self: Module, sectionIdMsgBelongsTo: string, chatI
|
||||||
notificationType = notification_details.NotificationType.NewMessageWithGlobalMention
|
notificationType = notification_details.NotificationType.NewMessageWithGlobalMention
|
||||||
|
|
||||||
let contactDetails = self.controller.getContactDetails(message.`from`)
|
let contactDetails = self.controller.getContactDetails(message.`from`)
|
||||||
let renderedMessageText = self.controller.getRenderedText(message.parsedText)
|
let communityChats = self.controller.getCommunityById(chatDetails.communityId).chats
|
||||||
|
let renderedMessageText = self.controller.getRenderedText(message.parsedText, communityChats)
|
||||||
let plainText = singletonInstance.utils.plainText(renderedMessageText)
|
let plainText = singletonInstance.utils.plainText(renderedMessageText)
|
||||||
var notificationTitle = contactDetails.defaultDisplayName
|
var notificationTitle = contactDetails.defaultDisplayName
|
||||||
|
|
||||||
|
|
|
@ -188,7 +188,7 @@ proc newModule*[T](
|
||||||
)
|
)
|
||||||
result.stickersModule = stickers_module.newModule(result, events, stickersService, settingsService, walletAccountService, networkService, tokenService)
|
result.stickersModule = stickers_module.newModule(result, events, stickersService, settingsService, walletAccountService, networkService, tokenService)
|
||||||
result.activityCenterModule = activity_center_module.newModule(result, events, activityCenterService, contactsService,
|
result.activityCenterModule = activity_center_module.newModule(result, events, activityCenterService, contactsService,
|
||||||
messageService, chatService)
|
messageService, chatService, communityService)
|
||||||
result.communitiesModule = communities_module.newModule(result, events, communityService, contactsService)
|
result.communitiesModule = communities_module.newModule(result, events, communityService, contactsService)
|
||||||
result.appSearchModule = app_search_module.newModule(result, events, contactsService, chatService, communityService,
|
result.appSearchModule = app_search_module.newModule(result, events, contactsService, chatService, communityService,
|
||||||
messageService)
|
messageService)
|
||||||
|
|
|
@ -680,7 +680,7 @@ QtObject:
|
||||||
self.threadpool.start(arg)
|
self.threadpool.start(arg)
|
||||||
|
|
||||||
# See render-inline in status-mobile/src/status_im/ui/screens/chat/message/message.cljs
|
# See render-inline in status-mobile/src/status_im/ui/screens/chat/message/message.cljs
|
||||||
proc renderInline(self: Service, parsedText: ParsedText): string =
|
proc renderInline(self: Service, parsedText: ParsedText, communityChats: seq[ChatDto]): string =
|
||||||
let value = escape_html(parsedText.literal)
|
let value = escape_html(parsedText.literal)
|
||||||
.multiReplace(("\r\n", "<br/>"))
|
.multiReplace(("\r\n", "<br/>"))
|
||||||
.multiReplace(("\n", "<br/>"))
|
.multiReplace(("\n", "<br/>"))
|
||||||
|
@ -712,7 +712,11 @@ proc renderInline(self: Service, parsedText: ParsedText): string =
|
||||||
let contactDto = self.contactService.getContactById(id)
|
let contactDto = self.contactService.getContactById(id)
|
||||||
result = fmt("<a href=\"//{id}\" class=\"mention\">{contactDto.userDefaultDisplayName()}</a>")
|
result = fmt("<a href=\"//{id}\" class=\"mention\">{contactDto.userDefaultDisplayName()}</a>")
|
||||||
of PARSED_TEXT_CHILD_TYPE_STATUS_TAG:
|
of PARSED_TEXT_CHILD_TYPE_STATUS_TAG:
|
||||||
result = fmt("<a href=\"#{value}\" class=\"status-tag\">#{value}</a>")
|
result = fmt("<span>#{value}</span>")
|
||||||
|
for chat in communityChats:
|
||||||
|
if chat.name == value:
|
||||||
|
result = fmt("<a href=\"#{value}\" class=\"status-tag\">#{value}</a>")
|
||||||
|
break
|
||||||
of PARSED_TEXT_CHILD_TYPE_DEL:
|
of PARSED_TEXT_CHILD_TYPE_DEL:
|
||||||
result = fmt("<del>{value}</del>")
|
result = fmt("<del>{value}</del>")
|
||||||
of PARSED_TEXT_CHILD_TYPE_LINK:
|
of PARSED_TEXT_CHILD_TYPE_LINK:
|
||||||
|
@ -721,13 +725,13 @@ proc renderInline(self: Service, parsedText: ParsedText): string =
|
||||||
result = fmt(" {value} ")
|
result = fmt(" {value} ")
|
||||||
|
|
||||||
# See render-block in status-mobile/src/status_im/ui/screens/chat/message/message.cljs
|
# See render-block in status-mobile/src/status_im/ui/screens/chat/message/message.cljs
|
||||||
proc getRenderedText*(self: Service, parsedTextArray: seq[ParsedText]): string =
|
proc getRenderedText*(self: Service, parsedTextArray: seq[ParsedText], communityChats: seq[ChatDto]): string =
|
||||||
for parsedText in parsedTextArray:
|
for parsedText in parsedTextArray:
|
||||||
case parsedText.type:
|
case parsedText.type:
|
||||||
of PARSED_TEXT_TYPE_PARAGRAPH:
|
of PARSED_TEXT_TYPE_PARAGRAPH:
|
||||||
result = result & "<p>"
|
result = result & "<p>"
|
||||||
for child in parsedText.children:
|
for child in parsedText.children:
|
||||||
result = result & self.renderInline(child)
|
result = result & self.renderInline(child, communityChats)
|
||||||
result = result & "</p>"
|
result = result & "</p>"
|
||||||
of PARSED_TEXT_TYPE_BLOCKQUOTE:
|
of PARSED_TEXT_TYPE_BLOCKQUOTE:
|
||||||
result = result & "<blockquote>" & escape_html(parsedText.literal) & "</blockquote>"
|
result = result & "<blockquote>" & escape_html(parsedText.literal) & "</blockquote>"
|
||||||
|
|
Loading…
Reference in New Issue