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 = proc chatName(self: ChannelsList, chatItem: Chat): string =
if not chatItem.chatType.isOneToOne: return chatItem.name 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 != "": if chatItem.ensName != "":
return "@" & userName(chatItem.ensName).userName(true) return "@" & userName(chatItem.ensName).userName(true)
return self.userNameOrAlias(chatItem.id) return self.userNameOrAlias(chatItem.id)

View File

@ -47,6 +47,8 @@ QtObject:
if self.chatItem.name == self.chatItem.id: if self.chatItem.name == self.chatItem.id:
result = self.userNameOrAlias(self.chatItem.id) result = self.userNameOrAlias(self.chatItem.id)
else: 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 != "": if self.chatItem.ensName != "":
result = "@" & userName(self.chatItem.ensName).userName(true) result = "@" & userName(self.chatItem.ensName).userName(true)
else: else:

View File

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