From 10918acb5cd514794377df8518524cc09b2a8314 Mon Sep 17 00:00:00 2001 From: decanus <7621705+decanus@users.noreply.github.com> Date: Tue, 14 Jul 2020 12:29:37 +0200 Subject: [PATCH] adds ens in header --- src/app/chat/view.nim | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/app/chat/view.nim b/src/app/chat/view.nim index 2c1c354b3d..837ceb06f8 100644 --- a/src/app/chat/view.nim +++ b/src/app/chat/view.nim @@ -81,6 +81,11 @@ QtObject: proc activeChannelChanged*(self: ChatsView) {.signal.} + proc userNameOrAlias*(self: ChatsView, pubKey: string): string {.slot.} = + if self.status.chat.contacts.hasKey(pubKey): + return status_ens.userNameOrAlias(self.status.chat.contacts[pubKey]) + generateAlias(pubKey) + proc setActiveChannelByIndex*(self: ChatsView, index: int) {.slot.} = if(self.chats.chats.len == 0): return var response = self.status.chat.markAllChannelMessagesRead(self.activeChannel.id) @@ -88,6 +93,10 @@ QtObject: self.chats.clearUnreadMessagesCount(self.activeChannel.chatItem) let selectedChannel = self.chats.getChannel(index) if self.activeChannel.id == selectedChannel.id: return + + if selectedChannel.chatType.isOneToOne: + selectedChannel.name = self.userNameOrAlias(selectedChannel.id) + self.activeChannel.setChatItem(selectedChannel) self.status.chat.setActiveChannel(selectedChannel.id) self.activeChannelChanged() @@ -256,13 +265,7 @@ QtObject: proc generateIdenticon*(self: ChatsView, pk: string): string {.slot.} = result = status_accounts.generateIdenticon(pk) - proc userNameOrAlias*(self: ChatsView, pubKey: string): string {.slot.} = - if self.status.chat.contacts.hasKey(pubKey): - return status_ens.userNameOrAlias(self.status.chat.contacts[pubKey]) - generateAlias(pubKey) - # Resolving a ENS name - proc resolveENS*(self: ChatsView, ens: string) {.slot.} = spawnAndSend(self, "ensResolved") do: # Call self.ensResolved(string) when ens is resolved status_ens.pubkey(ens)