ContactsStore: getProfileContext simplified
This commit is contained in:
parent
c4828a094b
commit
8fb9440235
|
@ -118,7 +118,7 @@ Item {
|
||||||
ringSettings.ringSpecModel: model.colorHash
|
ringSettings.ringSpecModel: model.colorHash
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (mouse.button === Qt.RightButton) {
|
if (mouse.button === Qt.RightButton) {
|
||||||
const { profileType, trustStatus, contactType, ensVerified, onlineStatus, hasLocalNickname } = root.store.contactsStore.getProfileContext(model.pubKey, userProfile.pubKey)
|
const { profileType, trustStatus, contactType, ensVerified, onlineStatus, hasLocalNickname } = root.store.contactsStore.getProfileContext(model.pubKey)
|
||||||
const chatType = chatContentModule.chatDetails.type
|
const chatType = chatContentModule.chatDetails.type
|
||||||
const isAdmin = chatContentModule.amIChatAdmin()
|
const isAdmin = chatContentModule.amIChatAdmin()
|
||||||
|
|
||||||
|
|
|
@ -311,7 +311,7 @@ Item {
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if(mouse.button === Qt.RightButton) {
|
if(mouse.button === Qt.RightButton) {
|
||||||
const { profileType, trustStatus, contactType, ensVerified, onlineStatus, hasLocalNickname } = root.rootStore.contactsStore.getProfileContext(model.pubKey, Global.userProfile.pubKey)
|
const { profileType, trustStatus, contactType, ensVerified, onlineStatus, hasLocalNickname } = root.rootStore.contactsStore.getProfileContext(model.pubKey)
|
||||||
|
|
||||||
Global.openMenu(memberContextMenuComponent, this, {
|
Global.openMenu(memberContextMenuComponent, this, {
|
||||||
profileType, trustStatus, contactType, ensVerified, onlineStatus, hasLocalNickname,
|
profileType, trustStatus, contactType, ensVerified, onlineStatus, hasLocalNickname,
|
||||||
|
|
|
@ -178,11 +178,11 @@ QtObject {
|
||||||
function getLinkToProfile(publicKey) {
|
function getLinkToProfile(publicKey) {
|
||||||
return root.contactsModule.shareUserUrlWithData(publicKey)
|
return root.contactsModule.shareUserUrlWithData(publicKey)
|
||||||
}
|
}
|
||||||
function getProfileContext(publicKey, myPublicKey, isBridgedAccount = false) {
|
function getProfileContext(publicKey, isBridgedAccount = false) {
|
||||||
const contactDetails = Utils.getContactDetailsAsJson(publicKey, true, true)
|
const contactDetails = Utils.getContactDetailsAsJson(publicKey, true, true)
|
||||||
if (!contactDetails)
|
if (!contactDetails)
|
||||||
return {
|
return {
|
||||||
profileType: getProfileType(publicKey, myPublicKey, isBridgedAccount, false),
|
profileType: getProfileType(publicKey, isBridgedAccount, false),
|
||||||
trustStatus: Constants.trustStatus.unknown,
|
trustStatus: Constants.trustStatus.unknown,
|
||||||
contactType: getContactType(Constants.ContactRequestState.None, false),
|
contactType: getContactType(Constants.ContactRequestState.None, false),
|
||||||
ensVerified: false,
|
ensVerified: false,
|
||||||
|
@ -191,7 +191,7 @@ QtObject {
|
||||||
}
|
}
|
||||||
|
|
||||||
const isBlocked = contactDetails.isBlocked
|
const isBlocked = contactDetails.isBlocked
|
||||||
const profileType = getProfileType(publicKey, myPublicKey, isBridgedAccount, isBlocked)
|
const profileType = getProfileType(publicKey, isBridgedAccount, isBlocked)
|
||||||
const contactType = getContactType(contactDetails.contactRequestState, contactDetails.isContact)
|
const contactType = getContactType(contactDetails.contactRequestState, contactDetails.isContact)
|
||||||
const trustStatus = contactDetails.trustStatus
|
const trustStatus = contactDetails.trustStatus
|
||||||
const ensVerified = contactDetails.ensVerified
|
const ensVerified = contactDetails.ensVerified
|
||||||
|
@ -201,8 +201,8 @@ QtObject {
|
||||||
return { profileType, trustStatus, contactType, ensVerified, onlineStatus, hasLocalNickname }
|
return { profileType, trustStatus, contactType, ensVerified, onlineStatus, hasLocalNickname }
|
||||||
}
|
}
|
||||||
|
|
||||||
function getProfileType(publicKey, myPublicKey, isBridgedAccount, isBlocked) {
|
function getProfileType(publicKey, isBridgedAccount, isBlocked) {
|
||||||
if (publicKey === myPublicKey) return Constants.profileType.self
|
if (publicKey === root.myPublicKey) return Constants.profileType.self
|
||||||
if (isBridgedAccount) return Constants.profileType.bridged
|
if (isBridgedAccount) return Constants.profileType.bridged
|
||||||
if (isBlocked) return Constants.profileType.blocked
|
if (isBlocked) return Constants.profileType.blocked
|
||||||
return Constants.profileType.regular
|
return Constants.profileType.regular
|
||||||
|
|
|
@ -34,7 +34,7 @@ SettingsContentBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
function openContextMenu(publicKey, name, icon) {
|
function openContextMenu(publicKey, name, icon) {
|
||||||
const { profileType, trustStatus, contactType, ensVerified, onlineStatus, hasLocalNickname } = root.contactsStore.getProfileContext(publicKey, root.contactsStore.myPublicKey)
|
const { profileType, trustStatus, contactType, ensVerified, onlineStatus, hasLocalNickname } = root.contactsStore.getProfileContext(publicKey)
|
||||||
|
|
||||||
Global.openMenu(contactContextMenuComponent, this, {
|
Global.openMenu(contactContextMenuComponent, this, {
|
||||||
profileType, trustStatus, contactType, ensVerified, onlineStatus, hasLocalNickname,
|
profileType, trustStatus, contactType, ensVerified, onlineStatus, hasLocalNickname,
|
||||||
|
|
|
@ -162,7 +162,7 @@ Loader {
|
||||||
}
|
}
|
||||||
const publicKey = isReply ? quotedMessageFrom : root.senderId
|
const publicKey = isReply ? quotedMessageFrom : root.senderId
|
||||||
const isBridgedAccount = isReply ? (quotedMessageContentType === Constants.messageContentType.bridgeMessageType) : root.isBridgeMessage
|
const isBridgedAccount = isReply ? (quotedMessageContentType === Constants.messageContentType.bridgeMessageType) : root.isBridgeMessage
|
||||||
const { profileType, trustStatus, contactType, ensVerified, onlineStatus, hasLocalNickname } = root.contactsStore.getProfileContext(publicKey, root.rootStore.contactsStore.myPublicKey, isBridgedAccount)
|
const { profileType, trustStatus, contactType, ensVerified, onlineStatus, hasLocalNickname } = root.contactsStore.getProfileContext(publicKey, isBridgedAccount)
|
||||||
const chatType = chatContentModule.chatDetails.type
|
const chatType = chatContentModule.chatDetails.type
|
||||||
// set false for now, because the remove from group option is still available after member is removed
|
// set false for now, because the remove from group option is still available after member is removed
|
||||||
const isAdmin = false // chatContentModule.amIChatAdmin()
|
const isAdmin = false // chatContentModule.amIChatAdmin()
|
||||||
|
|
Loading…
Reference in New Issue