fix(chat_section): only call community function for communities

This commit is contained in:
Jonathan Rainville 2023-08-24 10:21:01 -04:00
parent 12a3ca366a
commit aad7cf9416
1 changed files with 12 additions and 2 deletions

View File

@ -456,11 +456,15 @@ proc updateParentBadgeNotifications(self: Module) =
) )
proc updateChatLocked(self: Module, chatId: string) = proc updateChatLocked(self: Module, chatId: string) =
if not self.controller.isCommunity():
return
let communityId = self.controller.getMySectionId() let communityId = self.controller.getMySectionId()
let locked = self.controller.checkChatIsLocked(communityId, chatId) let locked = self.controller.checkChatIsLocked(communityId, chatId)
self.view.chatsModel().setItemLocked(chatId, locked) self.view.chatsModel().setItemLocked(chatId, locked)
proc updateChatRequiresPermissions(self: Module, chatId: string) = proc updateChatRequiresPermissions(self: Module, chatId: string) =
if not self.controller.isCommunity():
return
let communityId = self.controller.getMySectionId let communityId = self.controller.getMySectionId
let requiresPermissions = self.controller.checkChatHasPermissions(communityId, chatId) let requiresPermissions = self.controller.checkChatHasPermissions(communityId, chatId)
self.view.chatsModel().setItemPermissionsRequired(chatId, requiresPermissions) self.view.chatsModel().setItemPermissionsRequired(chatId, requiresPermissions)
@ -599,8 +603,14 @@ method addNewChat*(
categoryOpened, categoryOpened,
onlineStatus = onlineStatus, onlineStatus = onlineStatus,
loaderActive = setChatAsActive, loaderActive = setChatAsActive,
locked = self.controller.checkChatIsLocked(self.controller.getMySectionId(), chatDto.id), locked = if self.controller.isCommunity:
requiresPermissions = self.controller.checkChatHasPermissions(self.controller.getMySectionId(), chatDto.id) 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( self.addSubmodule(