fix: show ens and alias on profile popup header

This commit is contained in:
Richard Ramos 2020-08-07 15:42:15 -04:00
parent e96f3ed47f
commit edbb183242
No known key found for this signature in database
GPG Key ID: 80D4B01265FDFE8F
3 changed files with 9 additions and 4 deletions

View File

@ -147,6 +147,9 @@ QtObject:
proc appReady*(self: ChatsView) {.signal.}
proc alias*(self: ChatsView, pubKey: string): string {.slot.} =
generateAlias(pubKey)
proc userNameOrAlias*(self: ChatsView, pubKey: string): string {.slot.} =
if self.status.chat.contacts.hasKey(pubKey):
return status_ens.userNameOrAlias(self.status.chat.contacts[pubKey])

View File

@ -38,10 +38,10 @@ QtObject:
generateAlias(pubKey)
proc name*(self: ChatItemView): string {.slot.} =
if self.chatItem != nil:
if self.chatItem != nil and self.chatItem.chatType.isOneToOne:
result = self.userNameOrAlias(self.chatItem.id)
else:
result = self.chatItem.name
result = ?.self.chatItem.name
QtProperty[string] name:
read = name

View File

@ -11,6 +11,7 @@ ModalPopup {
property var userName: ""
property var fromAuthor: ""
property var text: ""
property var alias: ""
property bool showQR: false
property bool isEnsVerified: false
@ -23,6 +24,7 @@ ModalPopup {
this.identicon = identiconParam
this.text = textParam
this.isEnsVerified = chatsModel.isEnsVerified(this.fromAuthor)
this.alias = chatsModel.alias(this.fromAuthor)
}
function openPopup(userNameParam, fromAuthorParam, identiconParam) {
@ -65,9 +67,9 @@ ModalPopup {
}
StyledText {
text: fromAuthor
text: isEnsVerified ? alias : fromAuthor
width: 160
elide: Text.ElideMiddle
elide: !isEnsVerified ? Text.ElideMiddle : Text.ElideNone
anchors.left: profilePic.right
anchors.leftMargin: Style.current.smallPadding
anchors.top: profileName.bottom