fix(group-chat): fix changing group chat name

This commit is contained in:
Jonathan Rainville 2022-04-14 10:14:15 -04:00 committed by Iuri Matias
parent c58a656a52
commit ddbe4e236d
4 changed files with 12 additions and 0 deletions

View File

@ -124,6 +124,12 @@ proc init*(self: Controller) =
return
self.delegate.onChatRenamed(args.newName)
self.events.on(SIGNAL_CHAT_UPDATE) do(e: Args):
var args = ChatUpdateArgsNew(e)
for chat in args.chats:
if self.chatId == chat.id:
self.delegate.onChatEdited(chat)
proc getMyChatId*(self: Controller): string =
return self.chatId

View File

@ -330,3 +330,4 @@ method onChatEdited*(self: Module, chatDto: ChatDto) =
method onChatRenamed*(self: Module, newName: string) =
self.view.updateChatDetailsName(newName)
self.messagesModule.updateChatIdentifier()

View File

@ -788,6 +788,7 @@ method addChatIfDontExist*(self: Module,
return
if self.doesCatOrChatExist(chat.id):
self.onChatRenamed(chat.id, chat.name)
return
self.addNewChat(chat, belongsToCommunity, events, settingsService, contactService, chatService,

View File

@ -447,6 +447,10 @@ QtObject:
error "error while renaming group chat", msg
return
var chat = self.chats[chatID]
chat.name = name
self.updateOrAddChat(chat)
self.events.emit(SIGNAL_CHAT_RENAMED, ChatRenameArgs(id: chatId, newName: name))
except Exception as e:
error "error while renaming group chat: ", msg = e.msg