fix(ActivityNotificationMessage): use ProfileUtils.displayName()

to compose the primary/secondary user names, just like we do in the
message views, or the Profile dialog
This commit is contained in:
Lukáš Tinkl 2023-04-19 18:31:26 +02:00 committed by Lukáš Tinkl
parent 297b73fced
commit c209e7c282
2 changed files with 8 additions and 4 deletions

View File

@ -89,9 +89,9 @@ Item {
Loader { Loader {
id: secondaryDisplayNameLoader id: secondaryDisplayNameLoader
active: !root.amISender && !!root.sender.secondaryName active: !root.amISender && !!root.sender.secondaryName
visible: active
asynchronous: true asynchronous: true
sourceComponent: StatusBaseText { sourceComponent: StatusBaseText {
id: secondaryDisplayName
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
color: Theme.palette.baseColor1 color: Theme.palette.baseColor1
font.pixelSize: Theme.asideTextFontSize font.pixelSize: Theme.asideTextFontSize

View File

@ -24,9 +24,13 @@ ActivityNotificationBase {
messageText: notification ? notification.message.messageText : "" messageText: notification ? notification.message.messageText : ""
amISender: false amISender: false
sender.id: contactId sender.id: contactId
sender.displayName: contactDetails ? contactDetails.displayName : "" sender.displayName: contactDetails ? ProfileUtils.displayName(contactDetails.localNickname, contactDetails.ensVerified ? contactDetails.name : "",
sender.secondaryName: contactDetails ? contactDetails.localNickname : "" contactDetails.displayName, contactDetails.alias) : ""
sender.secondaryName: contactDetails && contactDetails.localNickname ? ProfileUtils.displayName("", contactDetails.ensVerified ? contactDetails.name : "",
contactDetails.displayName, contactDetails.alias) : ""
sender.trustIndicator: contactDetails ? contactDetails.trustStatus : Constants.trustStatus.unknown sender.trustIndicator: contactDetails ? contactDetails.trustStatus : Constants.trustStatus.unknown
sender.isEnsVerified: !!contactDetails && contactDetails.ensVerified
sender.isContact: !!contactDetails && contactDetails.isContact
sender.profileImage { sender.profileImage {
width: 40 width: 40
height: 40 height: 40
@ -34,7 +38,7 @@ ActivityNotificationBase {
assetSettings.isImage: contactDetails && contactDetails.displayIcon.startsWith("data") assetSettings.isImage: contactDetails && contactDetails.displayIcon.startsWith("data")
pubkey: contactId pubkey: contactId
colorId: Utils.colorIdForPubkey(contactId) colorId: Utils.colorIdForPubkey(contactId)
colorHash: Utils.getColorHashAsJson(contactId, contactDetails && contactDetails.ensVerified) colorHash: Utils.getColorHashAsJson(contactId, sender.isEnsVerified)
} }
} }