parent
add8163f31
commit
c85734f08d
|
@ -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
|
||||
|
|
|
@ -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 chatDto = self.chatService.getChatById(self.chatId)
|
||||
return chatDto.members.map(x => x.id)
|
||||
else:
|
||||
let communityDto = self.communityService.getCommunityById(self.sectionId)
|
||||
result = communityDto.members.map(x => x.id)
|
||||
return communityDto.members.map(x => x.id)
|
||||
|
||||
method getContactNameAndImage*(self: Controller, contactId: string):
|
||||
tuple[name: string, image: string, isIdenticon: bool] =
|
||||
|
|
|
@ -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) =
|
||||
|
|
Loading…
Reference in New Issue