From 863c4f5d7a28e4e78ef0a88690599aad6670d25e Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Wed, 17 May 2023 14:27:58 -0400 Subject: [PATCH] fix(chat_section): make chat hidden if category collapsed when creating Fixes #10381 --- src/app/modules/main/chat_section/controller.nim | 6 +++--- src/app/modules/main/chat_section/module.nim | 6 +++++- src/app_service/service/community/service.nim | 3 +-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/app/modules/main/chat_section/controller.nim b/src/app/modules/main/chat_section/controller.nim index 390b7bc368..ba2b3ded97 100644 --- a/src/app/modules/main/chat_section/controller.nim +++ b/src/app/modules/main/chat_section/controller.nim @@ -184,9 +184,9 @@ proc init*(self: Controller) = self.events.on(SIGNAL_COMMUNITY_CHANNEL_CREATED) do(e:Args): let args = CommunityChatArgs(e) let belongsToCommunity = args.chat.communityId.len > 0 - discard self.delegate.addOrUpdateChat(args.chat, belongsToCommunity, self.events, self.settingsService, self.nodeConfigurationService, - self.contactService, self.chatService, self.communityService, self.messageService, self.gifService, - self.mailserversService, setChatAsActive = true) + discard self.delegate.addOrUpdateChat(args.chat, belongsToCommunity, self.events, self.settingsService, + self.nodeConfigurationService, self.contactService, self.chatService, self.communityService, + self.messageService, self.gifService, self.mailserversService, setChatAsActive = true) self.events.on(SIGNAL_COMMUNITY_CHANNEL_DELETED) do(e:Args): let args = CommunityChatIdArgs(e) diff --git a/src/app/modules/main/chat_section/module.nim b/src/app/modules/main/chat_section/module.nim index cc0c436902..055ca92c47 100644 --- a/src/app/modules/main/chat_section/module.nim +++ b/src/app/modules/main/chat_section/module.nim @@ -589,7 +589,10 @@ method addNewChat*( if chatDto.chatType != ChatType.PrivateGroupChat: amIChatAdmin = amIChatAdmin or channelGroup.admin + var categoryOpened = true if chatDto.categoryId != "": + let categoryItem = self.view.chatsModel.getItemById(chatDto.categoryId) + categoryOpened = categoryItem.categoryOpened if channelGroup.id != "": for category in channelGroup.categories: if category.id == chatDto.categoryId: @@ -623,8 +626,9 @@ method addNewChat*( colorId, colorHash, chatDto.highlight, + categoryOpened, onlineStatus = onlineStatus, - loaderActive = setChatAsActive + loaderActive = setChatAsActive, ) self.addSubmodule( chatDto.id, diff --git a/src/app_service/service/community/service.nim b/src/app_service/service/community/service.nim index 31f3535ab4..4d1b006fb4 100644 --- a/src/app_service/service/community/service.nim +++ b/src/app_service/service/community/service.nim @@ -1061,8 +1061,7 @@ QtObject: color: string, categoryId: string) = try: - let response = status_go.createCommunityChannel(communityId, name, description, emoji, color, - categoryId) + let response = status_go.createCommunityChannel(communityId, name, description, emoji, color, categoryId) if not response.error.isNil: let error = Json.decode($response.error, RpcError)