fix(chat_section_module): Don't force update icon and name for 1-1 chats

This commit is contained in:
Igor Sirotin 2022-12-21 11:16:21 +03:00 committed by Igor Sirotin
parent 4fc52dddcb
commit eb9f94630a
2 changed files with 9 additions and 9 deletions

View File

@ -344,7 +344,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, chatDto.icon, chatDto.chatType == ChatType.OneToOne) self.view.updateChatDetails(chatDto)
self.messagesModule.updateChatFetchMoreMessages() self.messagesModule.updateChatFetchMoreMessages()
self.messagesModule.updateChatIdentifier() self.messagesModule.updateChatIdentifier()

View File

@ -1,6 +1,6 @@
import NimQml import NimQml
import ../../../shared_models/message_model as pinned_msg_model import ../../../shared_models/message_model as pinned_msg_model
import ../../../../../app_service/service/contacts/dto/contacts as contacts_dto import ../../../../../app_service/service/chat/dto/chat as chat_dto
import io_interface import io_interface
import chat_details import chat_details
@ -128,13 +128,13 @@ 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, icon: string, ignoreName: bool) = proc updateChatDetails*(self: View, chatDto: ChatDto) =
if not ignoreName: if chatDto.chatType != ChatType.OneToOne:
self.chatDetails.setName(name) self.chatDetails.setName(chatDto.name)
self.chatDetails.setDescription(description) self.chatDetails.setIcon(chatDto.icon)
self.chatDetails.setEmoji(emoji) self.chatDetails.setDescription(chatDto.description)
self.chatDetails.setColor(color) self.chatDetails.setEmoji(chatDto.emoji)
self.chatDetails.setIcon(icon) self.chatDetails.setColor(chatDto.color)
proc updateChatDetailsName*(self: View, name: string) = proc updateChatDetailsName*(self: View, name: string) =
self.chatDetails.setName(name) self.chatDetails.setName(name)