fix: proper content for bridged messages in OS notifications (#14377)

This commit is contained in:
Igor Sirotin 2024-04-09 18:21:47 +01:00 committed by GitHub
parent 277dda7533
commit e2eddc525c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 2 deletions

View File

@ -1183,13 +1183,17 @@ method onNewMessagesReceived*(self: Module, sectionIdMsgBelongsTo: string, chatI
elif(message.isGlobalMention()): elif(message.isGlobalMention()):
notificationType = notification_details.NotificationType.NewMessageWithGlobalMention notificationType = notification_details.NotificationType.NewMessageWithGlobalMention
let contactDetails = self.controller.getContactDetails(message.`from`) var senderDisplayName = self.controller.getContactDetails(message.`from`).defaultDisplayName
let communityChats = self.controller.getMyCommunity().chats let communityChats = self.controller.getMyCommunity().chats
let renderedMessageText = self.controller.getRenderedText(message.parsedText, communityChats) let renderedMessageText = self.controller.getRenderedText(message.parsedText, communityChats)
var plainText = singletonInstance.utils.plainText(renderedMessageText) var plainText = singletonInstance.utils.plainText(renderedMessageText)
if message.contentType == ContentType.Sticker or (message.contentType == ContentType.Image and len(plainText) == 0): if message.contentType == ContentType.Sticker or (message.contentType == ContentType.Image and len(plainText) == 0):
plainText = "🖼️" plainText = "🖼️"
var notificationTitle = contactDetails.defaultDisplayName if message.contentType == ContentType.BridgeMessage:
senderDisplayName = message.bridgeMessage.userName
plainText = message.bridgeMessage.content
var notificationTitle = senderDisplayName
case chatDetails.chatType: case chatDetails.chatType:
of ChatType.PrivateGroupChat: of ChatType.PrivateGroupChat: