fix(@desktop/communities): changing contact nickname must be reflected in users list

This commit is contained in:
Andrei Smirnov 2021-08-30 19:09:33 +03:00 committed by Iuri Matias
parent 1c7fa14903
commit 8ae050b642
4 changed files with 10 additions and 15 deletions

View File

@ -75,7 +75,7 @@ QtObject:
proc updateMemberVisibility*(self: CommunitiesView, statusUpdate: StatusUpdate) =
self.joinedCommunityList.updateMemberVisibility(statusUpdate)
self.activeCommunity.setCommunityItem(self.joinedCommunityList.getCommunityById(self.activeCommunity.communityItem.id))
self.activeCommunity.triggerMemberUpdate()
self.activeCommunity.triggerMembersUpdate()
proc populateChats(self: CommunitiesView, communities: var seq[Community]): seq[Community] =
result = @[]

View File

@ -194,7 +194,7 @@ QtObject:
proc getMembers*(self: CommunityItemView): QVariant {.slot.} =
result = newQVariant(self.members)
proc triggerMemberUpdate*(self: CommunityItemView) =
proc triggerMembersUpdate*(self: CommunityItemView) {.slot.} =
self.members.triggerUpdate()
proc memberLastSeen*(self: CommunityItemView, pubKey: string): string {.slot.} =

View File

@ -56,7 +56,10 @@ QtObject:
proc userName(self: CommunityMembersView, pk: string, alias: string): string =
if self.status.chat.contacts.hasKey(pk):
result = ens.userNameOrAlias(self.status.chat.contacts[pk])
if self.status.chat.contacts[pk].localNickname != "":
result = self.status.chat.contacts[pk].localNickname
else:
result = ens.userNameOrAlias(self.status.chat.contacts[pk])
else:
result = alias
@ -114,17 +117,6 @@ QtObject:
of CommunityMembersRoles.StatusType: result = newQVariant(self.memberStatus(communityMemberPubkey))
of CommunityMembersRoles.Online: result = newQVariant(self.isOnline(communityMemberPubkey))
of CommunityMembersRoles.SortKey: result = newQVariant(self.sortKey(communityMemberPubkey))
proc rowData(self: CommunityMembersView, index: int, column: string): string {.slot.} =
if (index >= self.community.members.len):
return
let communityMemberPubkey = self.community.members[index]
case column:
of "alias": result = self.alias(communityMemberPubkey)
of "address": result = communityMemberPubkey
of "identicon": result = self.identicon(communityMemberPubkey)
of "localNickname": result = self.localNickname(communityMemberPubkey)
of "ensName": result = self.userName(communityMemberPubkey, self.alias(communityMemberPubkey))
method roleNames(self: CommunityMembersView): Table[int, string] =
{
@ -139,4 +131,4 @@ QtObject:
proc triggerUpdate*(self: CommunityMembersView) =
self.beginResetModel()
self.endResetModel()
self.endResetModel()

View File

@ -117,6 +117,9 @@ ModalPopup {
popup.changeNickname(nicknameInput.textField.text)
profileModel.contacts.changeContactNickname(fromAuthor, nicknameInput.textField.text)
popup.close()
if (!!chatsModel.communities.activeCommunity) {
chatsModel.communities.activeCommunity.triggerMembersUpdate()
}
}
}
}