diff --git a/src/app/modules/main/chat_section/chat_content/module.nim b/src/app/modules/main/chat_section/chat_content/module.nim index e60cc2d22b..760a5cf4d3 100644 --- a/src/app/modules/main/chat_section/chat_content/module.nim +++ b/src/app/modules/main/chat_section/chat_content/module.nim @@ -54,7 +54,7 @@ proc newModule*(delegate: delegate_interface.AccessInterface, events: EventEmitt result.messagesModule = messages_module.newModule(result, events, sectionId, chatId, belongsToCommunity, contactService, communityService, chatService, messageService, mailserversService) result.usersModule = users_module.newModule(result, events, sectionId, chatId, belongsToCommunity, isUsersListAvailable, - contactService, communityService, messageService) + contactService, chatService, communityService, messageService) method delete*(self: Module) = self.inputAreaModule.delete diff --git a/src/app/modules/main/chat_section/chat_content/users/controller.nim b/src/app/modules/main/chat_section/chat_content/users/controller.nim index bb86a024cc..e7ab79aae1 100644 --- a/src/app/modules/main/chat_section/chat_content/users/controller.nim +++ b/src/app/modules/main/chat_section/chat_content/users/controller.nim @@ -21,12 +21,14 @@ type belongsToCommunity: bool isUsersListAvailable: bool #users list is not available for 1:1 chat contactService: contact_service.Service + chatService: chat_service.Service communityService: community_service.Service messageService: message_service.Service proc newController*(delegate: io_interface.AccessInterface, events: EventEmitter, sectionId: string, chatId: string, belongsToCommunity: bool, isUsersListAvailable: bool, contactService: contact_service.Service, - communityService: community_service.Service, messageService: message_service.Service): + chatService: chat_service.Service, communityService: community_service.Service, + messageService: message_service.Service): Controller = result = Controller() result.delegate = delegate @@ -36,6 +38,7 @@ proc newController*(delegate: io_interface.AccessInterface, events: EventEmitter result.belongsToCommunity = belongsToCommunity result.isUsersListAvailable = isUsersListAvailable result.contactService = contactService + result.chatService = chatService result.communityService = communityService result.messageService = messageService @@ -84,12 +87,12 @@ method init*(self: Controller) = self.delegate.onChatMembersAdded(@[args.pubKey]) method getMembersPublicKeys*(self: Controller): seq[string] = - # in case of 1:1 chat, there is no a members list if(not self.belongsToCommunity): - return - - let communityDto = self.communityService.getCommunityById(self.sectionId) - result = communityDto.members.map(x => x.id) + let chatDto = self.chatService.getChatById(self.chatId) + return chatDto.members.map(x => x.id) + else: + let communityDto = self.communityService.getCommunityById(self.sectionId) + return communityDto.members.map(x => x.id) method getContactNameAndImage*(self: Controller, contactId: string): tuple[name: string, image: string, isIdenticon: bool] = diff --git a/src/app/modules/main/chat_section/chat_content/users/module.nim b/src/app/modules/main/chat_section/chat_content/users/module.nim index 9cdaca8a7b..b4b10076ee 100644 --- a/src/app/modules/main/chat_section/chat_content/users/module.nim +++ b/src/app/modules/main/chat_section/chat_content/users/module.nim @@ -6,6 +6,7 @@ import ../../../../shared_models/[user_model, user_item] import ../../../../../global/global_singleton import ../../../../../core/eventemitter import ../../../../../../app_service/service/contacts/service as contact_service +import ../../../../../../app_service/service/chat/service as chat_service import ../../../../../../app_service/service/community/service as community_service import ../../../../../../app_service/service/message/service as message_service @@ -21,14 +22,15 @@ type proc newModule*(delegate: delegate_interface.AccessInterface, events: EventEmitter, sectionId: string, chatId: string, belongsToCommunity: bool, isUsersListAvailable: bool, contactService: contact_service.Service, - communityService: community_service.Service, messageService: message_service.Service): + chatService: chat_service.Service, communityService: community_service.Service, + messageService: message_service.Service): Module = result = Module() result.delegate = delegate result.view = view.newView(result) result.viewVariant = newQVariant(result.view) result.controller = controller.newController(result, events, sectionId, chatId, belongsToCommunity, isUsersListAvailable, - contactService, communityService, messageService) + contactService, chatService, communityService, messageService) result.moduleLoaded = false method delete*(self: Module) =