From 124ce83ba70c95147a49bd6d3971fd2c5e059972 Mon Sep 17 00:00:00 2001 From: Richard Ramos Date: Tue, 17 Nov 2020 10:45:14 -0400 Subject: [PATCH] fix: show local nicknames --- src/app/chat/views/channels_list.nim | 2 ++ src/app/chat/views/chat_item.nim | 2 ++ src/status/ens.nim | 2 ++ 3 files changed, 6 insertions(+) diff --git a/src/app/chat/views/channels_list.nim b/src/app/chat/views/channels_list.nim index 4bcd3cb31c..953792b709 100644 --- a/src/app/chat/views/channels_list.nim +++ b/src/app/chat/views/channels_list.nim @@ -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) diff --git a/src/app/chat/views/chat_item.nim b/src/app/chat/views/chat_item.nim index 46c50fcb97..541b467413 100644 --- a/src/app/chat/views/chat_item.nim +++ b/src/app/chat/views/chat_item.nim @@ -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: diff --git a/src/status/ens.nim b/src/status/ens.nim index a1432832d1..0b4554edd8 100644 --- a/src/status/ens.nim +++ b/src/status/ens.nim @@ -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)