ProfileHeader and related components refactored to use compressed key directly
This commit is contained in:
parent
e58a6c83ce
commit
544f749f44
|
@ -127,7 +127,8 @@ Item {
|
|||
|
||||
Global.openMenu(profileContextMenuComponent, this, {
|
||||
profileType, trustStatus, contactType, ensVerified, onlineStatus, hasLocalNickname, chatType, isAdmin,
|
||||
publicKey: model.pubKey,
|
||||
pubKey: model.pubKey,
|
||||
compressedPubKey: model.compressedPubKey,
|
||||
emojiHash: model.emojiHash,
|
||||
colorHash: model.colorHash,
|
||||
colorId: model.colorId,
|
||||
|
@ -170,25 +171,28 @@ Item {
|
|||
|
||||
ProfileContextMenu {
|
||||
id: profileContextMenu
|
||||
|
||||
property string pubKey
|
||||
|
||||
margins: 8
|
||||
onOpenProfileClicked: Global.openProfilePopup(profileContextMenu.publicKey, null)
|
||||
onOpenProfileClicked: Global.openProfilePopup(profileContextMenu.pubKey, null)
|
||||
onCreateOneToOneChat: {
|
||||
Global.changeAppSectionBySectionType(Constants.appSection.chat)
|
||||
root.store.chatCommunitySectionModule.createOneToOneChat("", profileContextMenu.publicKey, "")
|
||||
root.store.chatCommunitySectionModule.createOneToOneChat("", profileContextMenu.pubKey, "")
|
||||
}
|
||||
onReviewContactRequest: Global.openReviewContactRequestPopup(profileContextMenu.publicKey, null)
|
||||
onSendContactRequest: Global.openContactRequestPopup(profileContextMenu.publicKey, null)
|
||||
onEditNickname: Global.openNicknamePopupRequested(profileContextMenu.publicKey, null)
|
||||
onReviewContactRequest: Global.openReviewContactRequestPopup(profileContextMenu.pubKey, null)
|
||||
onSendContactRequest: Global.openContactRequestPopup(profileContextMenu.pubKey, null)
|
||||
onEditNickname: Global.openNicknamePopupRequested(profileContextMenu.pubKey, null)
|
||||
onRemoveNickname: (displayName) => {
|
||||
root.store.contactsStore.changeContactNickname(profileContextMenu.publicKey, "", displayName, true)
|
||||
root.store.contactsStore.changeContactNickname(profileContextMenu.pubKey, "", displayName, true)
|
||||
}
|
||||
onUnblockContact: Global.unblockContactRequested(profileContextMenu.publicKey)
|
||||
onMarkAsUntrusted: Global.markAsUntrustedRequested(profileContextMenu.publicKey)
|
||||
onRemoveTrustStatus: root.store.contactsStore.removeTrustStatus(profileContextMenu.publicKey)
|
||||
onRemoveContact: Global.removeContactRequested(profileContextMenu.publicKey)
|
||||
onBlockContact: Global.blockContactRequested(profileContextMenu.publicKey)
|
||||
onUnblockContact: Global.unblockContactRequested(profileContextMenu.pubKey)
|
||||
onMarkAsUntrusted: Global.markAsUntrustedRequested(profileContextMenu.pubKey)
|
||||
onRemoveTrustStatus: root.store.contactsStore.removeTrustStatus(profileContextMenu.pubKey)
|
||||
onRemoveContact: Global.removeContactRequested(profileContextMenu.pubKey)
|
||||
onBlockContact: Global.blockContactRequested(profileContextMenu.pubKey)
|
||||
onRemoveFromGroup: {
|
||||
root.store.removeMemberFromGroupChat(profileContextMenu.publicKey)
|
||||
root.store.removeMemberFromGroupChat(profileContextMenu.pubKey)
|
||||
}
|
||||
onClosed: destroy()
|
||||
}
|
||||
|
|
|
@ -318,7 +318,9 @@ Item {
|
|||
|
||||
Global.openMenu(memberContextMenuComponent, this, {
|
||||
profileType, trustStatus, contactType, ensVerified, onlineStatus, hasLocalNickname,
|
||||
publicKey: model.pubKey, emojiHash: root.utilsStore.getEmojiHash(model.pubKey),
|
||||
pubKey: model.pubKey,
|
||||
compressedPubKey: model.compressedPubKey,
|
||||
emojiHash: root.utilsStore.getEmojiHash(model.pubKey),
|
||||
colorHash: model.colorHash, colorId: model.colorId,
|
||||
displayName: memberItem.title || model.displayName,
|
||||
userIcon: icon.name,
|
||||
|
@ -337,22 +339,24 @@ Item {
|
|||
ProfileContextMenu {
|
||||
id: memberContextMenuView
|
||||
|
||||
onOpenProfileClicked: Global.openProfilePopup(memberContextMenuView.publicKey, null)
|
||||
property string pubKey
|
||||
|
||||
onOpenProfileClicked: Global.openProfilePopup(memberContextMenuView.pubKey, null)
|
||||
onCreateOneToOneChat: {
|
||||
Global.changeAppSectionBySectionType(Constants.appSection.chat)
|
||||
root.rootStore.chatCommunitySectionModule.createOneToOneChat("", membersContextMenuView.publicKey, "")
|
||||
root.rootStore.chatCommunitySectionModule.createOneToOneChat("", membersContextMenuView.pubKey, "")
|
||||
}
|
||||
onReviewContactRequest: Global.openReviewContactRequestPopup(memberContextMenuView.publicKey, null)
|
||||
onSendContactRequest: Global.openContactRequestPopup(memberContextMenuView.publicKey, null)
|
||||
onEditNickname: Global.openNicknamePopupRequested(memberContextMenuView.publicKey, null)
|
||||
onReviewContactRequest: Global.openReviewContactRequestPopup(memberContextMenuView.pubKey, null)
|
||||
onSendContactRequest: Global.openContactRequestPopup(memberContextMenuView.pubKey, null)
|
||||
onEditNickname: Global.openNicknamePopupRequested(memberContextMenuView.pubKey, null)
|
||||
onRemoveNickname: (displayName) => {
|
||||
root.rootStore.contactsStore.changeContactNickname(memberContextMenuView.publicKey, "", displayName, true)
|
||||
root.rootStore.contactsStore.changeContactNickname(memberContextMenuView.pubKey, "", displayName, true)
|
||||
}
|
||||
onUnblockContact: Global.unblockContactRequested(memberContextMenuView.publicKey)
|
||||
onMarkAsUntrusted: Global.markAsUntrustedRequested(memberContextMenuView.publicKey)
|
||||
onRemoveTrustStatus: root.rootStore.contactsStore.removeTrustStatus(memberContextMenuView.publicKey)
|
||||
onRemoveContact: Global.removeContactRequested(memberContextMenuView.publicKey)
|
||||
onBlockContact: Global.blockContactRequested(memberContextMenuView.publicKey)
|
||||
onUnblockContact: Global.unblockContactRequested(memberContextMenuView.pubKey)
|
||||
onMarkAsUntrusted: Global.markAsUntrustedRequested(memberContextMenuView.pubKey)
|
||||
onRemoveTrustStatus: root.rootStore.contactsStore.removeTrustStatus(memberContextMenuView.pubKey)
|
||||
onRemoveContact: Global.removeContactRequested(memberContextMenuView.pubKey)
|
||||
onBlockContact: Global.blockContactRequested(memberContextMenuView.pubKey)
|
||||
onClosed: destroy()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -162,10 +162,13 @@ QtObject {
|
|||
}
|
||||
|
||||
function getProfileType(publicKey, isBridgedAccount, isBlocked) {
|
||||
if (publicKey === root.myPublicKey) return Constants.profileType.self
|
||||
if (isBridgedAccount) return Constants.profileType.bridged
|
||||
if (isBlocked) return Constants.profileType.blocked
|
||||
return Constants.profileType.regular
|
||||
if (publicKey === root.myPublicKey)
|
||||
return Constants.profileType.self
|
||||
if (isBridgedAccount)
|
||||
return Constants.profileType.bridged
|
||||
|
||||
return isBlocked ? Constants.profileType.blocked
|
||||
: Constants.profileType.regular
|
||||
}
|
||||
|
||||
function getContactType(contactRequestState, isContact) {
|
||||
|
@ -174,8 +177,9 @@ QtObject {
|
|||
return Constants.contactType.contactRequestReceived
|
||||
case Constants.ContactRequestState.Sent:
|
||||
return Constants.contactType.contactRequestSent
|
||||
default:
|
||||
return isContact ? Constants.contactType.contact : Constants.contactType.nonContact
|
||||
}
|
||||
|
||||
return isContact ? Constants.contactType.contact
|
||||
: Constants.contactType.nonContact
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,22 +38,22 @@ SettingsContentBase {
|
|||
}
|
||||
}
|
||||
|
||||
function openContextMenu(publicKey, name, icon, colorHash, colorId) {
|
||||
const { profileType, trustStatus, contactType, ensVerified, onlineStatus, hasLocalNickname } = root.contactsStore.getProfileContext(publicKey)
|
||||
function openContextMenu(pubKey, compressedPubKey, name, icon, colorHash, colorId) {
|
||||
const { profileType, trustStatus, contactType, ensVerified, onlineStatus, hasLocalNickname } = root.contactsStore.getProfileContext(pubKey)
|
||||
|
||||
Global.openMenu(contactContextMenuComponent, this, {
|
||||
profileType, trustStatus, contactType, ensVerified, onlineStatus, hasLocalNickname,
|
||||
publicKey: publicKey,
|
||||
emojiHash: root.utilsStore.getEmojiHash(publicKey),
|
||||
profileType, trustStatus, contactType, ensVerified, onlineStatus,
|
||||
hasLocalNickname, pubKey, compressedPubKey,
|
||||
emojiHash: root.utilsStore.getEmojiHash(pubKey),
|
||||
displayName: name,
|
||||
userIcon: icon,
|
||||
colorHash, colorId
|
||||
})
|
||||
}
|
||||
|
||||
function fetchDataAndOpenContextMenu(model, publicKey) {
|
||||
const entry = ModelUtils.getByKey(model, "pubKey", publicKey)
|
||||
openContextMenu(publicKey, entry.preferredDisplayName,
|
||||
function fetchDataAndOpenContextMenu(model, pubKey) {
|
||||
const entry = ModelUtils.getByKey(model, "pubKey", pubKey)
|
||||
openContextMenu(pubKey, entry.compressedPubKey, entry.preferredDisplayName,
|
||||
entry.icon, entry.colorHash, entry.colorId)
|
||||
}
|
||||
|
||||
|
@ -68,19 +68,21 @@ SettingsContentBase {
|
|||
ProfileContextMenu {
|
||||
id: contactContextMenu
|
||||
|
||||
onOpenProfileClicked: Global.openProfilePopup(contactContextMenu.publicKey, null, null)
|
||||
onCreateOneToOneChat: root.contactsStore.joinPrivateChat(contactContextMenu.publicKey)
|
||||
onReviewContactRequest: Global.openReviewContactRequestPopup(contactContextMenu.publicKey, null)
|
||||
onSendContactRequest: Global.openContactRequestPopup(contactContextMenu.publicKey, null)
|
||||
onEditNickname: Global.openNicknamePopupRequested(contactContextMenu.publicKey, null)
|
||||
property string pubKey
|
||||
|
||||
onOpenProfileClicked: Global.openProfilePopup(contactContextMenu.pubKey, null, null)
|
||||
onCreateOneToOneChat: root.contactsStore.joinPrivateChat(contactContextMenu.pubKey)
|
||||
onReviewContactRequest: Global.openReviewContactRequestPopup(contactContextMenu.pubKey, null)
|
||||
onSendContactRequest: Global.openContactRequestPopup(contactContextMenu.pubKey, null)
|
||||
onEditNickname: Global.openNicknamePopupRequested(contactContextMenu.pubKey, null)
|
||||
onRemoveNickname: (displayName) => {
|
||||
root.contactsStore.changeContactNickname(contactContextMenu.publicKey, "", displayName, true)
|
||||
root.contactsStore.changeContactNickname(contactContextMenu.pubKey, "", displayName, true)
|
||||
}
|
||||
onUnblockContact: Global.unblockContactRequested(contactContextMenu.publicKey)
|
||||
onMarkAsUntrusted: Global.markAsUntrustedRequested(contactContextMenu.publicKey)
|
||||
onRemoveTrustStatus: root.contactsStore.removeTrustStatus(contactContextMenu.publicKey)
|
||||
onRemoveContact: Global.removeContactRequested(contactContextMenu.publicKey)
|
||||
onBlockContact: Global.blockContactRequested(contactContextMenu.publicKey)
|
||||
onUnblockContact: Global.unblockContactRequested(contactContextMenu.pubKey)
|
||||
onMarkAsUntrusted: Global.markAsUntrustedRequested(contactContextMenu.pubKey)
|
||||
onRemoveTrustStatus: root.contactsStore.removeTrustStatus(contactContextMenu.pubKey)
|
||||
onRemoveContact: Global.removeContactRequested(contactContextMenu.pubKey)
|
||||
onBlockContact: Global.blockContactRequested(contactContextMenu.pubKey)
|
||||
onClosed: destroy()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -277,7 +277,6 @@ SettingsContentBase {
|
|||
Layout.rightMargin: Theme.padding
|
||||
|
||||
displayName: profileStore.name
|
||||
pubkey: profileStore.pubkey
|
||||
icon: profileStore.profileLargeImage
|
||||
imageSize: ProfileHeader.ImageSize.Big
|
||||
|
||||
|
|
|
@ -872,10 +872,12 @@ Item {
|
|||
UserStatusContextMenu {
|
||||
id: userStatusContextMenu
|
||||
|
||||
readonly property string pubKey: appMain.profileStore.pubkey
|
||||
|
||||
y: profileButton.y - userStatusContextMenu.height + profileButton.height
|
||||
x: profileButton.x + profileButton.width + 5
|
||||
|
||||
pubKey: appMain.profileStore.pubkey
|
||||
compressedPubKey: appMain.profileStore.compressedPubKey
|
||||
emojiHash: appMain.utilsStore.getEmojiHash(pubKey)
|
||||
colorHash: appMain.profileStore.colorHash
|
||||
colorId: appMain.profileStore.colorId
|
||||
|
|
|
@ -22,7 +22,7 @@ Item {
|
|||
}
|
||||
|
||||
property string displayName
|
||||
property string pubkey
|
||||
property string compressedPubKey
|
||||
property string icon
|
||||
property url previewIcon: icon
|
||||
property int trustStatus
|
||||
|
@ -248,7 +248,7 @@ Item {
|
|||
Layout.fillWidth: true
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
visible: root.pubkeyVisible
|
||||
text: root.isBridgedAccount ? qsTr("Bridged from Discord") : Utils.getElidedCompressedPk(pubkey)
|
||||
text: root.isBridgedAccount ? qsTr("Bridged from Discord") : Utils.getElidedPk(compressedPubKey)
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
font.pixelSize: 13
|
||||
color: Theme.palette.secondaryText
|
||||
|
|
|
@ -8,7 +8,7 @@ import utils 1.0
|
|||
StatusMenu {
|
||||
id: root
|
||||
|
||||
property alias pubKey: header.pubkey
|
||||
property alias compressedPubKey: header.compressedPubKey
|
||||
property alias emojiHash: header.emojiHash
|
||||
property alias name: header.displayName
|
||||
property alias icon: header.icon
|
||||
|
|
|
@ -161,19 +161,21 @@ Loader {
|
|||
// so we don't enable to right click the unavailable profile
|
||||
return false
|
||||
}
|
||||
const publicKey = isReply ? quotedMessageFrom : root.senderId
|
||||
const pubKey = isReply ? quotedMessageFrom : root.senderId
|
||||
const isBridgedAccount = isReply ? (quotedMessageContentType === Constants.messageContentType.bridgeMessageType) : root.isBridgeMessage
|
||||
const { profileType, trustStatus, contactType, ensVerified, onlineStatus, hasLocalNickname } = root.contactsStore.getProfileContext(publicKey, isBridgedAccount)
|
||||
const { profileType, trustStatus, contactType, ensVerified, onlineStatus, hasLocalNickname } = root.contactsStore.getProfileContext(pubKey, isBridgedAccount)
|
||||
const chatType = chatContentModule.chatDetails.type
|
||||
// set false for now, because the remove from group option is still available after member is removed
|
||||
const isAdmin = false // chatContentModule.amIChatAdmin()
|
||||
|
||||
const params = { profileType, trustStatus, contactType, ensVerified, onlineStatus, hasLocalNickname, chatType, isAdmin,
|
||||
publicKey,
|
||||
const params = {
|
||||
profileType, trustStatus, contactType, ensVerified, onlineStatus,
|
||||
hasLocalNickname, chatType, isAdmin, pubKey,
|
||||
compressedPubKey: root.utilsStore.getCompressedPk(pubKey),
|
||||
displayName: isReply ? quotedMessageAuthorDetailsDisplayName : root.senderDisplayName,
|
||||
userIcon: isReply ? quotedMessageAuthorDetailsThumbnailImage : root.senderIcon,
|
||||
colorHash: isReply ? quotedMessageAuthorDetailsColorHash : root.senderColorHash,
|
||||
colorId: Utils.colorIdForPubkey(publicKey)
|
||||
colorId: Utils.colorIdForPubkey(pubKey)
|
||||
}
|
||||
|
||||
Global.openMenu(profileContextMenuComponent, sender, params)
|
||||
|
@ -1188,24 +1190,27 @@ Loader {
|
|||
id: profileContextMenuComponent
|
||||
ProfileContextMenu {
|
||||
id: profileContextMenu
|
||||
onOpenProfileClicked: Global.openProfilePopup(profileContextMenu.publicKey, null)
|
||||
|
||||
property string pubKey
|
||||
|
||||
onOpenProfileClicked: Global.openProfilePopup(profileContextMenu.pubKey, null)
|
||||
onCreateOneToOneChat: () => {
|
||||
Global.changeAppSectionBySectionType(Constants.appSection.chat)
|
||||
root.rootStore.chatCommunitySectionModule.createOneToOneChat("", profileContextMenu.publicKey, "")
|
||||
root.rootStore.chatCommunitySectionModule.createOneToOneChat("", profileContextMenu.pubKey, "")
|
||||
}
|
||||
onReviewContactRequest: Global.openReviewContactRequestPopup(profileContextMenu.publicKey, null)
|
||||
onSendContactRequest: Global.openContactRequestPopup(profileContextMenu.publicKey, null)
|
||||
onEditNickname: Global.openNicknamePopupRequested(profileContextMenu.publicKey, null)
|
||||
onReviewContactRequest: Global.openReviewContactRequestPopup(profileContextMenu.pubKey, null)
|
||||
onSendContactRequest: Global.openContactRequestPopup(profileContextMenu.pubKey, null)
|
||||
onEditNickname: Global.openNicknamePopupRequested(profileContextMenu.pubKey, null)
|
||||
onRemoveNickname: () => {
|
||||
root.rootStore.contactsStore.changeContactNickname(profileContextMenu.publicKey, "", profileContextMenu.displayName, true)
|
||||
root.rootStore.contactsStore.changeContactNickname(profileContextMenu.pubKey, "", profileContextMenu.displayName, true)
|
||||
}
|
||||
onUnblockContact: Global.unblockContactRequested(profileContextMenu.publicKey)
|
||||
onMarkAsUntrusted: Global.markAsUntrustedRequested(profileContextMenu.publicKey)
|
||||
onRemoveTrustStatus: root.rootStore.contactsStore.removeTrustStatus(profileContextMenu.publicKey)
|
||||
onRemoveContact: Global.removeContactRequested(profileContextMenu.publicKey)
|
||||
onBlockContact: Global.blockContactRequested(profileContextMenu.publicKey)
|
||||
onUnblockContact: Global.unblockContactRequested(profileContextMenu.pubKey)
|
||||
onMarkAsUntrusted: Global.markAsUntrustedRequested(profileContextMenu.pubKey)
|
||||
onRemoveTrustStatus: root.rootStore.contactsStore.removeTrustStatus(profileContextMenu.pubKey)
|
||||
onRemoveContact: Global.removeContactRequested(profileContextMenu.pubKey)
|
||||
onBlockContact: Global.blockContactRequested(profileContextMenu.pubKey)
|
||||
onRemoveFromGroup: () => {
|
||||
root.store.removeMemberFromGroupChat(profileContextMenu.publicKey)
|
||||
root.store.removeMemberFromGroupChat(profileContextMenu.pubKey)
|
||||
}
|
||||
onOpened: root.setMessageActive(root.messageId, true)
|
||||
onClosed: {
|
||||
|
|
|
@ -1,18 +1,19 @@
|
|||
import QtQuick 2.15
|
||||
import QtQuick.Controls 2.15
|
||||
|
||||
import StatusQ.Popups 0.1
|
||||
import StatusQ.Core.Utils 0.1 as StatusQUtils
|
||||
import utils 1.0
|
||||
import StatusQ.Popups 0.1
|
||||
|
||||
import shared 1.0
|
||||
import shared.status 1.0
|
||||
import shared.controls.chat 1.0
|
||||
import shared.controls.chat.menuItems 1.0
|
||||
import shared.status 1.0
|
||||
import utils 1.0
|
||||
|
||||
StatusMenu {
|
||||
id: root
|
||||
|
||||
property string publicKey: ""
|
||||
property string compressedPubKey: ""
|
||||
property string displayName: ""
|
||||
property string userIcon: ""
|
||||
property int trustStatus: Constants.trustStatus.unknown
|
||||
|
@ -45,7 +46,7 @@ StatusMenu {
|
|||
displayNamePlusIconsVisible: true
|
||||
editButtonVisible: false
|
||||
displayName: StatusQUtils.Emoji.parse(root.displayName, StatusQUtils.Emoji.size.verySmall)
|
||||
pubkey: root.publicKey
|
||||
compressedPubKey: root.compressedPubKey
|
||||
emojiHash: root.emojiHash
|
||||
colorHash: root.colorHash
|
||||
colorId: root.colorId
|
||||
|
|
Loading…
Reference in New Issue