From aad7cf9416a374dfa624c167b617c9752a9e45a9 Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Thu, 24 Aug 2023 10:21:01 -0400 Subject: [PATCH] fix(chat_section): only call community function for communities --- src/app/modules/main/chat_section/module.nim | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/app/modules/main/chat_section/module.nim b/src/app/modules/main/chat_section/module.nim index 800def853e..09c1a1d9db 100644 --- a/src/app/modules/main/chat_section/module.nim +++ b/src/app/modules/main/chat_section/module.nim @@ -456,11 +456,15 @@ proc updateParentBadgeNotifications(self: Module) = ) proc updateChatLocked(self: Module, chatId: string) = + if not self.controller.isCommunity(): + return let communityId = self.controller.getMySectionId() let locked = self.controller.checkChatIsLocked(communityId, chatId) self.view.chatsModel().setItemLocked(chatId, locked) proc updateChatRequiresPermissions(self: Module, chatId: string) = + if not self.controller.isCommunity(): + return let communityId = self.controller.getMySectionId let requiresPermissions = self.controller.checkChatHasPermissions(communityId, chatId) self.view.chatsModel().setItemPermissionsRequired(chatId, requiresPermissions) @@ -599,8 +603,14 @@ method addNewChat*( categoryOpened, onlineStatus = onlineStatus, loaderActive = setChatAsActive, - locked = self.controller.checkChatIsLocked(self.controller.getMySectionId(), chatDto.id), - requiresPermissions = self.controller.checkChatHasPermissions(self.controller.getMySectionId(), chatDto.id) + locked = if self.controller.isCommunity: + self.controller.checkChatIsLocked(self.controller.getMySectionId(), chatDto.id) + else: + false, + requiresPermissions = if self.controller.isCommunity: + self.controller.checkChatHasPermissions(self.controller.getMySectionId(), chatDto.id) + else: + false, ) self.addSubmodule(