chore: reduce the number of (verification) RPC calls

- when calling `Utils.getColorHashAsJson()` we don't actually need to
issue ID verification requests at all and there might be situations when
we know beforehand that we don't need the ENS verification either
- change these helper functions' syntax and do early returns in that case
- in MessageContextMenuView, the "contact details" were duplicated, so
remove one
- remove dead code, fix some warnings
This commit is contained in:
Lukáš Tinkl 2022-12-01 11:24:25 +01:00 committed by Lukáš Tinkl
parent 45774e66af
commit 9559789030
27 changed files with 72 additions and 77 deletions

View File

@ -60,6 +60,7 @@ Control {
property bool hasExpired: false property bool hasExpired: false
property double timestamp: 0 property double timestamp: 0
property var reactionsModel: [] property var reactionsModel: []
property bool hasLinks
property bool showHeader: true property bool showHeader: true
property bool isActiveMessage: false property bool isActiveMessage: false
@ -346,7 +347,7 @@ Control {
} }
Loader { Loader {
id: linksLoader id: linksLoader
active: !root.editMode active: !root.editMode && root.hasLinks
visible: active visible: active
} }
Loader { Loader {

View File

@ -1,6 +1,5 @@
import QtQuick 2.14 import QtQuick 2.14
import QtQuick.Shapes 1.13 import QtQuick.Shapes 1.13
import QtGraphicalEffects 1.13
import QtQuick.Layouts 1.14 import QtQuick.Layouts 1.14
import StatusQ.Core 0.1 import StatusQ.Core 0.1

View File

@ -198,7 +198,7 @@ Rectangle {
objectName: model.name objectName: model.name
color: ListView.isCurrentItem ? Style.current.backgroundHover : Style.current.transparent color: ListView.isCurrentItem ? Style.current.backgroundHover : Style.current.transparent
border.width: 0 border.width: 0
width: parent.width width: ListView.view.width
height: 42 height: 42
radius: Style.current.radius radius: Style.current.radius

View File

@ -77,7 +77,7 @@ Item {
readonly property bool ensVerified: Utils.isEnsVerified(model.pubKey) readonly property bool ensVerified: Utils.isEnsVerified(model.pubKey)
width: ListView.view.width width: ListView.view.width
nickName: model.localNickname nickName: model.localNickname
userName: ensVerified ? model.ensName : model.displayName !== "" ? model.displayName : model.alias userName: ensVerified ? model.ensName : model.displayName || model.alias
pubKey: ensVerified ? "" : Utils.getCompressedPk(model.pubKey) pubKey: ensVerified ? "" : Utils.getCompressedPk(model.pubKey)
isContact: model.isContact isContact: model.isContact
isVerified: model.isVerified isVerified: model.isVerified
@ -88,7 +88,7 @@ Item {
asset.isLetterIdenticon: (asset.name === "") asset.isLetterIdenticon: (asset.name === "")
asset.color: Utils.colorForColorId(model.colorId) asset.color: Utils.colorForColorId(model.colorId)
status: model.onlineStatus status: model.onlineStatus
ringSettings.ringSpecModel: ensVerified ? undefined : Utils.getColorHashAsJson(model.pubKey, true) // FIXME: use model.colorHash ringSettings.ringSpecModel: Utils.getColorHashAsJson(model.pubKey, ensVerified) // FIXME: use model.colorHash
onClicked: { onClicked: {
if (mouse.button === Qt.RightButton) { if (mouse.button === Qt.RightButton) {
// Set parent, X & Y positions for the messageContextMenu // Set parent, X & Y positions for the messageContextMenu

View File

@ -138,7 +138,7 @@ Item {
asset.isLetterIdenticon: !model.icon asset.isLetterIdenticon: !model.icon
asset.width: 40 asset.width: 40
asset.height: 40 asset.height: 40
ringSettings.ringSpecModel: !!model.ensName ? undefined : Utils.getColorHashAsJson(model.pubKey, true) ringSettings.ringSpecModel: Utils.getColorHashAsJson(model.pubKey, !!model.ensName)
statusListItemIcon.badge.visible: (root.panelType === CommunityMembersTabPanel.TabType.AllMembers) statusListItemIcon.badge.visible: (root.panelType === CommunityMembersTabPanel.TabType.AllMembers)
onClicked: root.userProfileClicked(model.pubKey) onClicked: root.userProfileClicked(model.pubKey)

View File

@ -57,9 +57,9 @@ StatusModal {
delegate: StatusListItem { delegate: StatusListItem {
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
property var contactDetails: Utils.getContactDetailsAsJson(model.pubKey) readonly property var contactDetails: Utils.getContactDetailsAsJson(model.pubKey, false)
property string displayName: contactDetails.displayName || popup.store.generateAlias(model.pubKey) readonly property string displayName: contactDetails.displayName || popup.store.generateAlias(model.pubKey)
asset.name: contactDetails.thumbnailImage asset.name: contactDetails.thumbnailImage
asset.isImage: true asset.isImage: true
title: displayName title: displayName

View File

@ -52,9 +52,8 @@ Item {
property bool stickersLoaded: false property bool stickersLoaded: false
property Timer timer: Timer { } property Timer timer: Timer { }
property var userList property var userList
property var contactDetails: Utils.getContactDetailsAsJson(root.activeChatId) property var contactDetails: Utils.getContactDetailsAsJson(root.activeChatId, false)
property bool isUserAdded: root.contactDetails.isAdded property bool isUserAdded: root.contactDetails.isAdded
property bool contactRequestReceived: root.contactDetails.requestReceived
signal openAppSearch() signal openAppSearch()
signal openStickerPackPopup(string stickerPackId) signal openStickerPackPopup(string stickerPackId)
@ -106,7 +105,7 @@ Item {
// This function is called once `1:1` or `group` chat is created. // This function is called once `1:1` or `group` chat is created.
function checkForCreateChatOptions(chatId) { function checkForCreateChatOptions(chatId) {
if(root.rootStore.createChatStartSendTransactionProcess) { if(root.rootStore.createChatStartSendTransactionProcess) {
if (Utils.getContactDetailsAsJson(chatId).ensVerified) { if (root.contactDetails.ensVerified) {
Global.openPopup(cmpSendTransactionWithEns); Global.openPopup(cmpSendTransactionWithEns);
} else { } else {
Global.openPopup(cmpSendTransactionNoEns); Global.openPopup(cmpSendTransactionNoEns);

View File

@ -207,7 +207,7 @@ ColumnLayout {
return return
} }
if (Utils.getContactDetailsAsJson(chatContentModule.getMyChatId()).ensVerified) { if (Utils.isEnsVerified(chatContentModule.getMyChatId())) {
Global.openPopup(root.sendTransactionWithEnsModal) Global.openPopup(root.sendTransactionWithEnsModal)
} else { } else {
Global.openPopup(root.sendTransactionNoEnsModal) Global.openPopup(root.sendTransactionNoEnsModal)

View File

@ -93,7 +93,7 @@ MembersSelectorBase {
if (resolvedPubKey === "") if (resolvedPubKey === "")
return return
const contactDetails = Utils.getContactDetailsAsJson(resolvedPubKey) const contactDetails = Utils.getContactDetailsAsJson(resolvedPubKey, false)
if (contactDetails.publicKey === root.rootStore.contactsStore.myPublicKey) if (contactDetails.publicKey === root.rootStore.contactsStore.myPublicKey)
return; return;

View File

@ -97,7 +97,7 @@ Item {
asset.isImage: !!asset.name asset.isImage: !!asset.name
asset.imgIsIdenticon: false asset.imgIsIdenticon: false
ringSettings { ringSettings {
ringSpecModel: Utils.getColorHashAsJson(root.pubKey, true) ringSpecModel: Utils.getColorHashAsJson(root.pubKey)
} }
} }
StatusRoundButton { StatusRoundButton {
@ -198,7 +198,7 @@ Item {
asset.width: 44 asset.width: 44
asset.height: 44 asset.height: 44
asset.color: "transparent" asset.color: "transparent"
ringSettings { ringSpecModel: Utils.getColorHashAsJson(root.pubKey, true) } ringSettings { ringSpecModel: Utils.getColorHashAsJson(root.pubKey) }
} }
} }

View File

@ -71,7 +71,7 @@ StatusListItem {
asset.isImage: asset.name.includes("data") asset.isImage: asset.name.includes("data")
asset.isLetterIdenticon: root.iconSource.toString() === "" asset.isLetterIdenticon: root.iconSource.toString() === ""
ringSettings { ringSettings {
ringSpecModel: d.ensVerified ? undefined : Utils.getColorHashAsJson(root.publicKey, true) ringSpecModel: Utils.getColorHashAsJson(root.publicKey, d.ensVerified)
ringPxSize: Math.max(asset.width / 24.0) ringPxSize: Math.max(asset.width / 24.0)
} }

View File

@ -442,7 +442,8 @@ Item {
identicon.asset.height: height identicon.asset.height: height
identicon.asset.charactersLen: 2 identicon.asset.charactersLen: 2
identicon.asset.color: Utils.colorForPubkey(appMain.rootStore.userProfileInst.pubKey) identicon.asset.color: Utils.colorForPubkey(appMain.rootStore.userProfileInst.pubKey)
identicon.ringSettings.ringSpecModel: appMain.rootStore.userProfileInst.ensName ? undefined : Utils.getColorHashAsJson(appMain.rootStore.userProfileInst.pubKey, true) identicon.ringSettings.ringSpecModel: Utils.getColorHashAsJson(appMain.rootStore.userProfileInst.pubKey,
appMain.rootStore.userProfileInst.ensName)
badge.visible: true badge.visible: true
badge.anchors { badge.anchors {

View File

@ -11,7 +11,7 @@ QtObject {
/* required */ property var rootStore /* required */ property var rootStore
function openSendIDRequestPopup(publicKey, cb) { function openSendIDRequestPopup(publicKey, cb) {
const contactDetails = Utils.getContactDetailsAsJson(publicKey) const contactDetails = Utils.getContactDetailsAsJson(publicKey, false)
const popup = Global.openPopup(sendIDRequestPopupComponent, { const popup = Global.openPopup(sendIDRequestPopupComponent, {
userPublicKey: publicKey, userPublicKey: publicKey,
userDisplayName: contactDetails.displayName, userDisplayName: contactDetails.displayName,
@ -74,7 +74,7 @@ QtObject {
} }
function openContactRequestPopup(publicKey, cb) { function openContactRequestPopup(publicKey, cb) {
const contactDetails = Utils.getContactDetailsAsJson(publicKey) const contactDetails = Utils.getContactDetailsAsJson(publicKey, false)
const popupProperties = { const popupProperties = {
userPublicKey: publicKey, userPublicKey: publicKey,
userDisplayName: contactDetails.displayName, userDisplayName: contactDetails.displayName,

View File

@ -17,7 +17,7 @@ ActivityNotificationMessage {
id: root id: root
readonly property var contactDetails: notification ? readonly property var contactDetails: notification ?
Utils.getContactDetailsAsJson(notification.author) : Utils.getContactDetailsAsJson(notification.author, false) :
null null
messageDetails.messageText: qsTr("Wants to join") messageDetails.messageText: qsTr("Wants to join")
@ -27,7 +27,7 @@ ActivityNotificationMessage {
messageDetails.sender.profileImage.assetSettings.isImage: true messageDetails.sender.profileImage.assetSettings.isImage: true
messageDetails.sender.profileImage.pubkey: notification ? notification.author : "" messageDetails.sender.profileImage.pubkey: notification ? notification.author : ""
messageDetails.sender.profileImage.colorId: Utils.colorIdForPubkey(notification ? notification.author : "") messageDetails.sender.profileImage.colorId: Utils.colorIdForPubkey(notification ? notification.author : "")
messageDetails.sender.profileImage.colorHash: Utils.getColorHashAsJson(notification ? notification.author : "", false, true) messageDetails.sender.profileImage.colorHash: Utils.getColorHashAsJson(notification ? notification.author : "", contactDetails.ensVerified)
messageBadgeComponent: CommunityBadge { messageBadgeComponent: CommunityBadge {
readonly property var community: notification ? readonly property var community: notification ?
@ -51,4 +51,4 @@ ActivityNotificationMessage {
onAcceptRequestToJoinCommunity: root.store.acceptRequestToJoinCommunity(notification.id, notification.communityId) onAcceptRequestToJoinCommunity: root.store.acceptRequestToJoinCommunity(notification.id, notification.communityId)
onDeclineRequestToJoinCommunity: root.store.declineRequestToJoinCommunity(notification.id, notification.communityId) onDeclineRequestToJoinCommunity: root.store.declineRequestToJoinCommunity(notification.id, notification.communityId)
} }
} }

View File

@ -19,12 +19,12 @@ ActivityNotificationMessage {
ctaComponent: ContactRequestCta { ctaComponent: ContactRequestCta {
readonly property string senderId: notification ? notification.message.senderId : "" readonly property string senderId: notification ? notification.message.senderId : ""
readonly property var contactDetails: notification ? readonly property var contactDetails: notification ?
Utils.getContactDetailsAsJson(notification.message.senderId) : Utils.getContactDetailsAsJson(notification.message.senderId, false) :
null null
pending: notification && notification.message.contactRequestState == Constants.contactRequestStatePending pending: notification && notification.message.contactRequestState === Constants.contactRequestStatePending
accepted: notification && notification.message.contactRequestState == Constants.contactRequestStateAccepted accepted: notification && notification.message.contactRequestState === Constants.contactRequestStateAccepted
dismissed: notification && notification.message.contactRequestState == Constants.contactRequestStateDismissed dismissed: notification && notification.message.contactRequestState === Constants.contactRequestStateDismissed
blocked: contactDetails && contactDetails.isBlocked blocked: contactDetails && contactDetails.isBlocked
onAcceptClicked: root.store.contactsStore.acceptContactRequest(senderId) onAcceptClicked: root.store.contactsStore.acceptContactRequest(senderId)
onDeclineClicked: root.store.contactsStore.dismissContactRequest(senderId) onDeclineClicked: root.store.contactsStore.dismissContactRequest(senderId)
@ -34,4 +34,4 @@ ActivityNotificationMessage {
root.store.contactsStore.blockContact(senderId) root.store.contactsStore.blockContact(senderId)
} }
} }
} }

View File

@ -53,7 +53,10 @@ ActivityNotificationBase {
height: messageRow.implicitHeight height: messageRow.implicitHeight
hoverEnabled: root.messageBadgeComponent hoverEnabled: root.messageBadgeComponent
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onClicked: root.messageClicked() onClicked: {
root.activityCenterStore.switchTo(notification)
root.closeActivityCenter()
}
RowLayout { RowLayout {
id: messageRow id: messageRow

View File

@ -115,7 +115,7 @@ Item {
interactive: false interactive: false
imageWidth: d.getSize(36, 64, 160) imageWidth: d.getSize(36, 64, 160)
imageHeight: imageWidth imageHeight: imageWidth
showRing: !root.userIsEnsVerified ensVerified: root.userIsEnsVerified
} }
StatusRoundButton { StatusRoundButton {

View File

@ -16,12 +16,13 @@ Loader {
property string name property string name
property string pubkey property string pubkey
property string image property string image
property bool showRing: true property bool showRing: !ensVerified
property bool interactive: true property bool interactive: true
property bool disabled: false property bool disabled: false
property bool ensVerified: false
property int colorId: Utils.colorIdForPubkey(pubkey) property int colorId: Utils.colorIdForPubkey(pubkey)
property var colorHash: Utils.getColorHashAsJson(pubkey) property var colorHash: Utils.getColorHashAsJson(pubkey, ensVerified)
signal clicked() signal clicked()
@ -30,7 +31,7 @@ Loader {
asset { asset {
width: root.imageWidth width: root.imageWidth
height: root.imageHeight height: root.imageHeight
color: Theme.palette.userCustomizationColors[root.colorId] color: Utils.colorForColorId(root.colorId)
name: root.image name: root.image
charactersLen: 2 charactersLen: 2
isImage: true isImage: true

View File

@ -28,6 +28,6 @@ StatusMemberListItem {
asset.isLetterIdenticon: (asset.name === "") asset.isLetterIdenticon: (asset.name === "")
status: model.onlineStatus status: model.onlineStatus
statusListItemIcon.badge.border.color: sensor.containsMouse ? Theme.palette.baseColor2 : Theme.palette.baseColor4 statusListItemIcon.badge.border.color: sensor.containsMouse ? Theme.palette.baseColor2 : Theme.palette.baseColor4
ringSettings.ringSpecModel: hasEnsName ? undefined : Utils.getColorHashAsJson(model.pubKey, true) ringSettings.ringSpecModel: Utils.getColorHashAsJson(model.pubKey, hasEnsName)
color: (sensor.containsMouse || highlighted) ? Theme.palette.baseColor2 : "transparent" color: (sensor.containsMouse || highlighted) ? Theme.palette.baseColor2 : "transparent"
} }

View File

@ -142,12 +142,12 @@ Popup {
delegate: Rectangle { delegate: Rectangle {
id: rectangle id: rectangle
objectName: "inputListRectangle_" + index objectName: "inputListRectangle_" + index
property variant myData: typeof modelData === "undefined" ? model : modelData property var myData: typeof modelData === "undefined" ? model : modelData
property string myText: popup.getText(myData) property string myText: popup.getText(myData)
visible: searchBox.text === "" || myText.includes(searchBox.text) visible: searchBox.text === "" || myText.includes(searchBox.text)
color: listView.currentIndex === index ? Style.current.backgroundHover : Style.current.transparent color: listView.currentIndex === index ? Style.current.backgroundHover : Style.current.transparent
border.width: 0 border.width: 0
width: parent.width width: ListView.view.width
height: visible ? 42 : 0 height: visible ? 42 : 0
radius: Style.current.radius radius: Style.current.radius

View File

@ -89,7 +89,7 @@ Popup {
onUninstallClicked: { onUninstallClicked: {
stickersModule.uninstall(packId) stickersModule.uninstall(packId)
stickerGrid.model = d.recentStickers stickerGrid.model = d.recentStickers
btnHistory.clicked() btnHistory.clicked(null)
} }
onBackClicked: { onBackClicked: {
stickerMarket.visible = false stickerMarket.visible = false

View File

@ -61,7 +61,7 @@ Item {
asset.width: 40 asset.width: 40
asset.height: 40 asset.height: 40
asset.color: Utils.colorForColorId(model.colorId) asset.color: Utils.colorForColorId(model.colorId)
ringSettings.ringSpecModel: model.ensName ? undefined : Utils.getColorHashAsJson(model.pubKey, true) ringSettings.ringSpecModel: Utils.getColorHashAsJson(model.pubKey, model.ensName)
statusListItemIcon.badge.border.color: Theme.palette.baseColor4 statusListItemIcon.badge.border.color: Theme.palette.baseColor4
statusListItemIcon.badge.implicitHeight: 14 // 10 px + 2 px * 2 borders statusListItemIcon.badge.implicitHeight: 14 // 10 px + 2 px * 2 borders
statusListItemIcon.badge.implicitWidth: 14 // 10 px + 2 px * 2 borders statusListItemIcon.badge.implicitWidth: 14 // 10 px + 2 px * 2 borders

View File

@ -264,7 +264,7 @@ Pane {
interactive: false interactive: false
imageWidth: 80 imageWidth: 80
imageHeight: imageWidth imageHeight: imageWidth
showRing: !d.contactDetails.ensVerified ensVerified: d.contactDetails.ensVerified
} }
ColumnLayout { ColumnLayout {

View File

@ -263,6 +263,7 @@ Item {
name: root.toAccount.name name: root.toAccount.name
pubkey: root.toAccount.pubKey pubkey: root.toAccount.pubKey
image: root.toAccount.icon image: root.toAccount.icon
ensVerified: root.toAccount.ensVerified
} }
SVGImage { SVGImage {
id: toInvalid id: toInvalid

View File

@ -61,7 +61,7 @@ StatusPopupMenu {
readonly property bool isContact: { readonly property bool isContact: {
return root.selectedUserPublicKey !== "" && !!contactDetails.isContact return root.selectedUserPublicKey !== "" && !!contactDetails.isContact
} }
readonly property bool isBlockedContact: (!!d.contactDetails && d.contactDetails.isBlocked) || false readonly property bool isBlockedContact: (!!contactDetails && contactDetails.isBlocked) || false
readonly property int outgoingVerificationStatus: { readonly property int outgoingVerificationStatus: {
if (root.selectedUserPublicKey === "" || root.isMe || !root.isContact) { if (root.selectedUserPublicKey === "" || root.isMe || !root.isContact) {
@ -97,12 +97,12 @@ StatusPopupMenu {
if (!root.selectedUserPublicKey || root.isMe || !root.isContact) { if (!root.selectedUserPublicKey || root.isMe || !root.isContact) {
return false return false
} }
return root.verificationStatus === Constants.verificationStatus.trusted || return root.outgoingVerificationStatus === Constants.verificationStatus.trusted ||
root.incomingVerificationStatus === Constants.verificationStatus.trusted root.incomingVerificationStatus === Constants.verificationStatus.trusted
} }
readonly property bool userTrustIsUnknown: d.contactDetails && d.contactDetails.trustStatus === Constants.trustStatus.unknown readonly property bool userTrustIsUnknown: contactDetails && contactDetails.trustStatus === Constants.trustStatus.unknown
readonly property bool userIsUntrustworthy: d.contactDetails && d.contactDetails.trustStatus === Constants.trustStatus.untrustworthy readonly property bool userIsUntrustworthy: contactDetails && contactDetails.trustStatus === Constants.trustStatus.untrustworthy
property var emojiReactionsReactedByUser: [] property var emojiReactionsReactedByUser: []
@ -138,25 +138,11 @@ StatusPopupMenu {
onClosed: { onClosed: {
// Reset selectedUserPublicKey so that associated properties get recalculated on re-open // Reset selectedUserPublicKey so that associated properties get recalculated on re-open
selectedUserPublicKey = "" selectedUserPublicKey = ""
d.contactDetails = {}
} }
width: Math.max(emojiContainer.visible ? emojiContainer.width : 0, width: Math.max(emojiContainer.visible ? emojiContainer.width : 0,
(root.isRightClickOnImage && !root.pinnedPopup) ? 176 : 230) (root.isRightClickOnImage && !root.pinnedPopup) ? 176 : 230)
onAboutToShow: {
if (root.isProfile && root.selectedUserPublicKey !== "") {
d.contactDetails = Utils.getContactDetailsAsJson(root.selectedUserPublicKey)
} else {
d.contactDetails = {}
}
}
QtObject {
id: d
property var contactDetails: ({})
}
Item { Item {
id: emojiContainer id: emojiContainer
width: emojiRow.width width: emojiRow.width
@ -193,11 +179,11 @@ StatusPopupMenu {
displayName: root.selectedUserDisplayName displayName: root.selectedUserDisplayName
pubkey: root.selectedUserPublicKey pubkey: root.selectedUserPublicKey
icon: root.selectedUserIcon icon: root.selectedUserIcon
trustStatus: d.contactDetails && d.contactDetails.trustStatus ? d.contactDetails.trustStatus trustStatus: contactDetails && contactDetails.trustStatus ? contactDetails.trustStatus
: Constants.trustStatus.unknown : Constants.trustStatus.unknown
isContact: root.isContact isContact: root.isContact
isCurrentUser: root.isMe isCurrentUser: root.isMe
userIsEnsVerified: (!!d.contactDetails && d.contactDetails.ensVerified) || false userIsEnsVerified: (!!contactDetails && contactDetails.ensVerified) || false
} }
Item { Item {
@ -300,7 +286,7 @@ StatusPopupMenu {
icon.name: "edit_pencil" icon.name: "edit_pencil"
enabled: root.isProfile && !root.isMe enabled: root.isProfile && !root.isMe
onTriggered: { onTriggered: {
Global.openNicknamePopupRequested(root.selectedUserPublicKey, d.contactDetails.localNickname, Global.openNicknamePopupRequested(root.selectedUserPublicKey, contactDetails.localNickname,
"%1 (%2)".arg(root.selectedUserDisplayName).arg(Utils.getElidedCompressedPk(root.selectedUserPublicKey))) "%1 (%2)".arg(root.selectedUserDisplayName).arg(Utils.getElidedCompressedPk(root.selectedUserPublicKey)))
root.close() root.close()
} }

View File

@ -466,7 +466,7 @@ Loader {
isEdited: root.isEdited isEdited: root.isEdited
hasMention: root.hasMention hasMention: root.hasMention
isPinned: root.pinnedMessage isPinned: root.pinnedMessage
pinnedBy: root.pinnedMessage && !root.isDiscordMessage ? Utils.getContactDetailsAsJson(root.messagePinnedBy).displayName : "" pinnedBy: root.pinnedMessage && !root.isDiscordMessage ? Utils.getContactDetailsAsJson(root.messagePinnedBy, false).displayName : ""
hasExpired: root.isExpired hasExpired: root.isExpired
reactionsModel: root.reactionsModel reactionsModel: root.reactionsModel
@ -621,15 +621,15 @@ Loader {
assetSettings.isImage: root.isDiscordMessage || root.senderIcon.startsWith("data") assetSettings.isImage: root.isDiscordMessage || root.senderIcon.startsWith("data")
pubkey: root.senderId pubkey: root.senderId
colorId: Utils.colorIdForPubkey(root.senderId) colorId: Utils.colorIdForPubkey(root.senderId)
colorHash: Utils.getColorHashAsJson(root.senderId, false, !root.isDiscordMessage) colorHash: Utils.getColorHashAsJson(root.senderId, root.senderIsEnsVerified)
showRing: !root.isDiscordMessage showRing: !root.isDiscordMessage && !root.senderIsEnsVerified
} }
} }
replyDetails: StatusMessageDetails { replyDetails: StatusMessageDetails {
messageText: delegate.replyMessage ? delegate.replyMessage.messageText messageText: delegate.replyMessage ? delegate.replyMessage.messageText
//: deleted message //: deleted message
: qsTr("<deleted>") : qsTr("<deleted>")
contentType: delegate.replyMessage ? delegate.convertContentType(delegate.replyMessage.contentType) : 0 contentType: delegate.replyMessage ? delegate.convertContentType(delegate.replyMessage.contentType) : 0
messageContent: { messageContent: {
if (!delegate.replyMessage) if (!delegate.replyMessage)
@ -646,7 +646,7 @@ Loader {
amISender: delegate.replyMessage && delegate.replyMessage.amISender amISender: delegate.replyMessage && delegate.replyMessage.amISender
sender.id: delegate.replyMessage ? delegate.replyMessage.senderId : "" sender.id: delegate.replyMessage ? delegate.replyMessage.senderId : ""
sender.isContact: delegate.replyMessage && delegate.replyMessage.senderIsAdded sender.isContact: delegate.replyMessage && delegate.replyMessage.senderIsAdded
sender.displayName: delegate.replyMessage ? delegate.replyMessage.senderDisplayName: "" sender.displayName: delegate.replyMessage ? delegate.replyMessage.senderDisplayName: ""
sender.isEnsVerified: delegate.replyMessage && delegate.replyMessage.senderEnsVerified sender.isEnsVerified: delegate.replyMessage && delegate.replyMessage.senderEnsVerified
sender.secondaryName: delegate.replyMessage ? delegate.replyMessage.senderOptionalName : "" sender.secondaryName: delegate.replyMessage ? delegate.replyMessage.senderOptionalName : ""
sender.profileImage { sender.profileImage {
@ -654,10 +654,10 @@ Loader {
height: 20 height: 20
name: delegate.replyMessage ? delegate.replyMessage.senderIcon : "" name: delegate.replyMessage ? delegate.replyMessage.senderIcon : ""
assetSettings.isImage: delegate.replyMessage && (delegate.replyMessage.contentType === Constants.messageContentType.discordMessageType || delegate.replyMessage.senderIcon.startsWith("data")) assetSettings.isImage: delegate.replyMessage && (delegate.replyMessage.contentType === Constants.messageContentType.discordMessageType || delegate.replyMessage.senderIcon.startsWith("data"))
showRing: delegate.replyMessage && delegate.replyMessage.contentType !== Constants.messageContentType.discordMessageType showRing: (delegate.replyMessage && delegate.replyMessage.contentType !== Constants.messageContentType.discordMessageType) && !sender.isEnsVerified
pubkey: delegate.replySenderId pubkey: delegate.replySenderId
colorId: Utils.colorIdForPubkey(delegate.replySenderId) colorId: Utils.colorIdForPubkey(delegate.replySenderId)
colorHash: Utils.getColorHashAsJson(delegate.replySenderId, false, !root.isDiscordMessage) colorHash: Utils.getColorHashAsJson(delegate.replySenderId, sender.isEnsVerified)
} }
} }
@ -703,6 +703,7 @@ Loader {
} }
} }
hasLinks: linkUrlsModel.count
linksComponent: Component { linksComponent: Component {
LinksMessageView { LinksMessageView {
linksModel: linkUrlsModel linksModel: linkUrlsModel

View File

@ -535,15 +535,16 @@ QtObject {
isSyncing: false, isSyncing: false,
removed: false, removed: false,
trustStatus: Constants.trustStatus.unknown, trustStatus: Constants.trustStatus.unknown,
verificationStatus: Constants.verificationStatus.unverified verificationStatus: Constants.verificationStatus.unverified,
incomingVerificationStatus: Constants.verificationStatus.unverified
} }
} }
} }
function isEnsVerified(publicKey, getVerificationRequest=true) { function isEnsVerified(publicKey) {
if (publicKey === "" || !isChatKey(publicKey) ) if (publicKey === "" || !isChatKey(publicKey) )
return return
return getContactDetailsAsJson(publicKey, getVerificationRequest).ensVerified return getContactDetailsAsJson(publicKey, false).ensVerified
} }
function getEmojiHashAsJson(publicKey) { function getEmojiHashAsJson(publicKey) {
@ -554,10 +555,12 @@ QtObject {
return JSON.parse(jsonObj) return JSON.parse(jsonObj)
} }
function getColorHashAsJson(publicKey, force=false, getVerificationRequest=true) { function getColorHashAsJson(publicKey, skipEnsVerification=false) {
if (publicKey === "" || !isChatKey(publicKey) ) if (publicKey === "" || !isChatKey(publicKey))
return return
if (!force && isEnsVerified(publicKey, getVerificationRequest)) if (skipEnsVerification) // we know already the user is ENS verified -> no color ring
return
if (isEnsVerified(publicKey)) // ENS verified -> no color ring
return return
let jsonObj = globalUtilsInst.getColorHashAsJson(publicKey) let jsonObj = globalUtilsInst.getColorHashAsJson(publicKey)
return JSON.parse(jsonObj) return JSON.parse(jsonObj)
@ -571,7 +574,7 @@ QtObject {
} }
function colorForColorId(colorId) { function colorForColorId(colorId) {
if (colorId < 0 || colorId >= Theme.palette.userCustomizationColors.length) { if (colorId < 0 || colorId >= Theme.palette.userCustomizationColors.length) {
console.warn("Utils.colorForColorId : colorId is out of bounds") console.warn("Utils.colorForColorId : colorId is out of bounds")
return StatusColors.colors['blue'] return StatusColors.colors['blue']
} }