fix(@desktop/chat): fix chat member getter for community

fixes: #5582
This commit is contained in:
Patryk Osmaczko 2022-05-10 17:54:30 +02:00 committed by Iuri Matias
parent 7b45ce60a7
commit a5be90761b
2 changed files with 7 additions and 6 deletions

1
.gitignore vendored
View File

@ -8,6 +8,7 @@ noBackup/
*.log *.log
.update.timestamp .update.timestamp
.vscode .vscode
.tours
bin/ bin/
/bottles/ /bottles/
pkg/ pkg/

View File

@ -130,18 +130,18 @@ proc init*(self: Controller) =
proc getChat*(self: Controller): ChatDto = proc getChat*(self: Controller): ChatDto =
return self.chatService.getChatById(self.chatId) return self.chatService.getChatById(self.chatId)
proc getChatMember*(self: Controller, id: string): ChatMember =
let chat = self.getChat()
for member in chat.members:
if (member.id == id):
return member
proc getChatMembers*(self: Controller): seq[ChatMember] = proc getChatMembers*(self: Controller): seq[ChatMember] =
var communityId = "" var communityId = ""
if (self.belongsToCommunity): if (self.belongsToCommunity):
communityId = self.sectionId communityId = self.sectionId
return self.chatService.getMembers(communityId, self.chatId) return self.chatService.getMembers(communityId, self.chatId)
proc getChatMember*(self: Controller, id: string): ChatMember =
let members = self.getChatMembers()
for member in members:
if (member.id == id):
return member
proc getMembersPublicKeys*(self: Controller): seq[string] = proc getMembersPublicKeys*(self: Controller): seq[string] =
if(self.belongsToCommunity): if(self.belongsToCommunity):
let communityDto = self.communityService.getCommunityById(self.sectionId) let communityDto = self.communityService.getCommunityById(self.sectionId)