fix(@dekstop/chat): members panel on the Community invite sender's app is only updated after the app is rebooted

Fixes #4870
This commit is contained in:
Sale Djenic 2022-02-24 18:15:54 +01:00 committed by Iuri Matias
parent a51aee1683
commit 343ce69e29
1 changed files with 15 additions and 4 deletions

View File

@ -47,6 +47,20 @@ proc newController*(
method delete*(self: Controller) =
discard
method handleCommunityOnlyConnections(self: Controller) =
self.events.on(SIGNAL_COMMUNITY_MEMBER_APPROVED) do(e: Args):
let args = CommunityMemberArgs(e)
if (args.communityId == self.sectionId):
self.delegate.onChatMembersAdded(@[args.pubKey])
self.events.on(SIGNAL_COMMUNITIES_UPDATE) do(e:Args):
let args = CommunitiesArgs(e)
for community in args.communities:
if (community.id != self.sectionId):
continue
let membersPubKeys = community.members.map(x => x.id)
self.delegate.onChatMembersAdded(membersPubKeys)
method init*(self: Controller) =
# TODO call this function again if isUsersListAvailable changes
if(self.isUsersListAvailable):
@ -88,10 +102,7 @@ method init*(self: Controller) =
self.delegate.onChatMemberUpdated(args.id, args.admin, args.joined)
if (self.belongsToCommunity):
self.events.on(SIGNAL_COMMUNITY_MEMBER_APPROVED) do(e: Args):
let args = CommunityMemberArgs(e)
if (args.communityId == self.sectionId):
self.delegate.onChatMembersAdded(@[args.pubKey])
self.handleCommunityOnlyConnections()
self.events.on(SIGNAL_COMMUNITY_MEMBER_REMOVED) do(e: Args):
let args = CommunityMemberArgs(e)