fix(Chat): don't override chatdetails name with pubkey substr
The issue is that, after an account accepts a contact request, the sender of the request receives a message signal where the chat's name in the response is the first 8 characters of the chat's public key. This is because status-go doesn't actually try to keep the chat's `name` up-to-date if it's a one on one chat. This results in chat details being updated with a name that is incorrect. This commit ensures we only update the name of the chat details if we indeed don't deal with a 1-on-1 chat. Fixes #5738
This commit is contained in:
parent
c47f3f2692
commit
851228544b
|
@ -325,7 +325,7 @@ method onNotificationsUpdated*(self: Module, hasUnreadMessages: bool, notificati
|
||||||
self.view.updateChatDetailsNotifications(hasUnreadMessages, notificationCount)
|
self.view.updateChatDetailsNotifications(hasUnreadMessages, notificationCount)
|
||||||
|
|
||||||
method onChatEdited*(self: Module, chatDto: ChatDto) =
|
method onChatEdited*(self: Module, chatDto: ChatDto) =
|
||||||
self.view.updateChatDetails(chatDto.name, chatDto.description, chatDto.emoji, chatDto.color)
|
self.view.updateChatDetails(chatDto.name, chatDto.description, chatDto.emoji, chatDto.color, chatDto.chatType == ChatType.OneToOne)
|
||||||
self.messagesModule.updateChatIdentifier()
|
self.messagesModule.updateChatIdentifier()
|
||||||
|
|
||||||
method onChatRenamed*(self: Module, newName: string) =
|
method onChatRenamed*(self: Module, newName: string) =
|
||||||
|
|
|
@ -111,8 +111,9 @@ QtObject:
|
||||||
proc amIChatAdmin*(self: View): bool {.slot.} =
|
proc amIChatAdmin*(self: View): bool {.slot.} =
|
||||||
return self.delegate.amIChatAdmin()
|
return self.delegate.amIChatAdmin()
|
||||||
|
|
||||||
proc updateChatDetails*(self: View, name, description, emoji, color: string) =
|
proc updateChatDetails*(self: View, name, description, emoji, color: string, ignoreName: bool) =
|
||||||
self.chatDetails.setName(name)
|
if not ignoreName:
|
||||||
|
self.chatDetails.setName(name)
|
||||||
self.chatDetails.setDescription(description)
|
self.chatDetails.setDescription(description)
|
||||||
self.chatDetails.setEmoji(emoji)
|
self.chatDetails.setEmoji(emoji)
|
||||||
self.chatDetails.setColor(color)
|
self.chatDetails.setColor(color)
|
||||||
|
|
|
@ -269,7 +269,7 @@ QtObject:
|
||||||
|
|
||||||
proc renameItem*(self: Model, id: string, name: string) =
|
proc renameItem*(self: Model, id: string, name: string) =
|
||||||
for i in 0 ..< self.items.len:
|
for i in 0 ..< self.items.len:
|
||||||
if(self.items[i].id == id):
|
if self.items[i].id == id:
|
||||||
self.items[i].BaseItem.name = name
|
self.items[i].BaseItem.name = name
|
||||||
let index = self.createIndex(i, 0, nil)
|
let index = self.createIndex(i, 0, nil)
|
||||||
self.dataChanged(index, index, @[ModelRole.Name.int])
|
self.dataChanged(index, index, @[ModelRole.Name.int])
|
||||||
|
|
|
@ -785,7 +785,8 @@ method addChatIfDontExist*(self: Module,
|
||||||
return
|
return
|
||||||
|
|
||||||
if self.doesCatOrChatExist(chat.id):
|
if self.doesCatOrChatExist(chat.id):
|
||||||
self.onChatRenamed(chat.id, chat.name)
|
if chat.chatType != ChatType.OneToOne:
|
||||||
|
self.onChatRenamed(chat.id, chat.name)
|
||||||
return
|
return
|
||||||
|
|
||||||
self.addNewChat(chat, belongsToCommunity, events, settingsService, contactService, chatService,
|
self.addNewChat(chat, belongsToCommunity, events, settingsService, contactService, chatService,
|
||||||
|
|
Loading…
Reference in New Issue