mirror of
https://github.com/status-im/status-desktop.git
synced 2025-01-17 01:51:24 +00:00
fix: make sure we only get a community when it's a community
Part of #11996
This commit is contained in:
parent
3d6c05a7d1
commit
057b6c2c0f
@ -82,7 +82,9 @@ method hasUnseenActivityCenterNotificationsChanged*(self: Module) =
|
||||
|
||||
proc createMessageItemFromDto(self: Module, message: MessageDto, communityId: string): MessageItem =
|
||||
let contactDetails = self.controller.getContactDetails(message.`from`)
|
||||
let communityChats = self.controller.getCommunityById(communityId).chats
|
||||
var communityChats: seq[ChatDto] = @[]
|
||||
if communityId != singletonInstance.userProfile.getPubKey():
|
||||
communityChats = self.controller.getCommunityById(communityId).chats
|
||||
|
||||
var quotedMessageAuthorDetails = ContactDetails()
|
||||
if message.quotedMessage.`from` != "":
|
||||
|
@ -245,7 +245,8 @@ method newMessagesLoaded*(self: Module, messages: seq[MessageDto], reactions: se
|
||||
else:
|
||||
quotedMessageAuthorDetails = self.controller.getContactDetails(message.quotedMessage.`from`)
|
||||
|
||||
var communityChats: seq[ChatDto]
|
||||
var communityChats: seq[ChatDto] = @[]
|
||||
if self.controller.belongsToCommunity():
|
||||
communityChats = self.controller.getCommunityDetails().chats
|
||||
|
||||
var renderedMessageText = self.controller.getRenderedText(message.parsedText, communityChats)
|
||||
@ -364,7 +365,9 @@ method messagesAdded*(self: Module, messages: seq[MessageDto]) =
|
||||
|
||||
for message in messages:
|
||||
let sender = self.controller.getContactDetails(message.`from`)
|
||||
let communityChats = self.controller.getCommunityDetails().chats
|
||||
var communityChats: seq[ChatDto] = @[]
|
||||
if self.controller.belongsToCommunity():
|
||||
communityChats = self.controller.getCommunityDetails().chats
|
||||
var quotedMessageAuthorDetails = ContactDetails()
|
||||
if message.quotedMessage.`from` != "":
|
||||
if(message.`from` == message.quotedMessage.`from`):
|
||||
@ -593,7 +596,9 @@ method updateContactDetails*(self: Module, contactId: string) =
|
||||
item.quotedMessageAuthorAvatar = updatedContact.icon
|
||||
|
||||
if item.messageContainsMentions and item.mentionedUsersPks.anyIt(it == contactId):
|
||||
let communityChats = self.controller.getCommunityDetails().chats
|
||||
var communityChats: seq[ChatDto] = @[]
|
||||
if self.controller.belongsToCommunity():
|
||||
communityChats = self.controller.getCommunityDetails().chats
|
||||
item.messageText = self.controller.getRenderedText(item.parsedText, communityChats)
|
||||
|
||||
method deleteMessage*(self: Module, messageId: string) =
|
||||
@ -611,7 +616,9 @@ method onMessageEdited*(self: Module, message: MessageDto) =
|
||||
return
|
||||
|
||||
let mentionedUsersPks = itemBeforeChange.mentionedUsersPks
|
||||
let communityChats = self.controller.getCommunityDetails().chats
|
||||
var communityChats: seq[ChatDto] = @[]
|
||||
if self.controller.belongsToCommunity():
|
||||
communityChats = self.controller.getCommunityDetails().chats
|
||||
|
||||
self.view.model().updateEditedMsg(
|
||||
message.id,
|
||||
|
@ -141,8 +141,6 @@ method addChat*(self: Module, itemId: string) =
|
||||
if(ind != -1):
|
||||
return
|
||||
let chatDto = self.controller.getChatDetails(itemId)
|
||||
if chatDto.chatType != ChatType.OneToOne and chatDto.chatType != ChatType.PrivateGroupChat:
|
||||
return
|
||||
self.addChat(chatDto)
|
||||
|
||||
method setName*(self: Module, itemId: string, name: string) =
|
||||
|
Loading…
x
Reference in New Issue
Block a user