fix: show local nicknames

This commit is contained in:
Richard Ramos 2020-11-17 10:45:14 -04:00 committed by Iuri Matias
parent a5b9511a55
commit 124ce83ba7
3 changed files with 6 additions and 0 deletions

View File

@ -44,6 +44,8 @@ QtObject:
proc chatName(self: ChannelsList, chatItem: Chat): string =
if not chatItem.chatType.isOneToOne: return chatItem.name
if self.status.chat.contacts.hasKey(chatItem.id) and self.status.chat.contacts[chatItem.id].hasNickname():
return self.status.chat.contacts[chatItem.id].localNickname
if chatItem.ensName != "":
return "@" & userName(chatItem.ensName).userName(true)
return self.userNameOrAlias(chatItem.id)

View File

@ -47,6 +47,8 @@ QtObject:
if self.chatItem.name == self.chatItem.id:
result = self.userNameOrAlias(self.chatItem.id)
else:
if self.status.chat.contacts.hasKey(self.chatItem.id) and self.status.chat.contacts[self.chatItem.id].hasNickname():
return self.status.chat.contacts[self.chatItem.id].localNickname
if self.chatItem.ensName != "":
result = "@" & userName(self.chatItem.ensName).userName(true)
else:

View File

@ -36,6 +36,8 @@ proc addDomain*(username: string): string =
else:
return username & domain
proc hasNickname*(contact: Profile): bool = contact.localNickname != ""
proc userNameOrAlias*(contact: Profile, removeSuffix: bool = false): string =
if(contact.ensName != "" and contact.ensVerified):
result = "@" & userName(contact.ensName, removeSuffix)