fix(InviteFriendsToCommunityPopup): Created single global instance. Fixed profile icons.
This commit is contained in:
parent
80bcb15bc3
commit
f32e551c75
|
@ -87,11 +87,10 @@ Rectangle {
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
anchors.top: welcomeText.bottom
|
anchors.top: welcomeText.bottom
|
||||||
anchors.topMargin: Style.current.padding
|
anchors.topMargin: Style.current.padding
|
||||||
onClicked: Global.openPopup(Global.inviteFriendsToCommunityPopup, {
|
onClicked: {
|
||||||
community: root.activeCommunity,
|
Global.openInviteFriendsToCommunityPopup(root.activeCommunity,
|
||||||
hasAddedContacts: root.hasAddedContacts,
|
root.communitySectionModule)
|
||||||
communitySectionModule: root.communitySectionModule
|
}
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
StatusFlatButton {
|
StatusFlatButton {
|
||||||
|
|
|
@ -24,7 +24,13 @@ StatusStackModal {
|
||||||
property string validationError: ""
|
property string validationError: ""
|
||||||
property string successMessage: ""
|
property string successMessage: ""
|
||||||
|
|
||||||
signal sendInvites(var pubKeys, string inviteMessage)
|
QtObject {
|
||||||
|
id: d
|
||||||
|
|
||||||
|
function sendInvites(pubKeys, inviteMessage) {
|
||||||
|
const error = root.communitySectionModule.inviteUsersToCommunity(JSON.stringify(pubKeys), inviteMessage);
|
||||||
|
d.processInviteResult(error);
|
||||||
|
}
|
||||||
|
|
||||||
function processInviteResult(error) {
|
function processInviteResult(error) {
|
||||||
if (error) {
|
if (error) {
|
||||||
|
@ -35,6 +41,7 @@ StatusStackModal {
|
||||||
root.successMessage = qsTr("Invite successfully sent");
|
root.successMessage = qsTr("Invite successfully sent");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
onOpened: {
|
onOpened: {
|
||||||
root.pubKeys = [];
|
root.pubKeys = [];
|
||||||
|
@ -44,7 +51,7 @@ StatusStackModal {
|
||||||
|
|
||||||
stackTitle: qsTr("Invite Contacts to %1").arg(community.name)
|
stackTitle: qsTr("Invite Contacts to %1").arg(community.name)
|
||||||
width: 640
|
width: 640
|
||||||
height: 700
|
implicitHeight: 700
|
||||||
leftPadding: 0
|
leftPadding: 0
|
||||||
rightPadding: 0
|
rightPadding: 0
|
||||||
|
|
||||||
|
@ -60,7 +67,7 @@ StatusStackModal {
|
||||||
enabled: root.pubKeys.length > 0
|
enabled: root.pubKeys.length > 0
|
||||||
text: qsTr("Send Invites")
|
text: qsTr("Send Invites")
|
||||||
onClicked: {
|
onClicked: {
|
||||||
root.sendInvites(root.pubKeys, root.inviteMessage);
|
d.sendInvites(root.pubKeys, root.inviteMessage);
|
||||||
root.close();
|
root.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -147,11 +147,10 @@ Item {
|
||||||
text: qsTr("Invite people")
|
text: qsTr("Invite people")
|
||||||
icon.name: "share-ios"
|
icon.name: "share-ios"
|
||||||
enabled: communityData.canManageUsers && adminPopupMenu.showInviteButton
|
enabled: communityData.canManageUsers && adminPopupMenu.showInviteButton
|
||||||
onTriggered: Global.openPopup(inviteFriendsToCommunityPopup, {
|
onTriggered: {
|
||||||
community: communityData,
|
Global.openInviteFriendsToCommunityPopup(root.communityData,
|
||||||
hasAddedContacts: root.hasAddedContacts,
|
root.communitySectionModule)
|
||||||
communitySectionModule: root.communitySectionModule
|
}
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -223,11 +222,10 @@ Item {
|
||||||
text: qsTr("Invite people")
|
text: qsTr("Invite people")
|
||||||
icon.name: "share-ios"
|
icon.name: "share-ios"
|
||||||
enabled: communityData.canManageUsers
|
enabled: communityData.canManageUsers
|
||||||
onTriggered: Global.openPopup(Global.inviteFriendsToCommunityPopup, {
|
onTriggered: {
|
||||||
community: communityData,
|
Global.openInviteFriendsToCommunityPopup(root.communityData,
|
||||||
hasAddedContacts: root.hasAddedContacts,
|
root.communitySectionModule)
|
||||||
communitySectionModule: root.communitySectionModule
|
}
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -193,10 +193,8 @@ StatusSectionLayout {
|
||||||
}
|
}
|
||||||
|
|
||||||
onInviteNewPeopleClicked: {
|
onInviteNewPeopleClicked: {
|
||||||
Global.openPopup(inviteFriendsToCommunityPopup, {
|
Global.openInviteFriendsToCommunityPopup(root.community,
|
||||||
community: root.community,
|
root.chatCommunitySectionModule)
|
||||||
hasAddedContacts: root.hasAddedContacts
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onAirdropTokensClicked: { /* TODO in future */ }
|
onAirdropTokensClicked: { /* TODO in future */ }
|
||||||
|
@ -252,21 +250,4 @@ StatusSectionLayout {
|
||||||
store: root.rootStore
|
store: root.rootStore
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Component {
|
|
||||||
id: inviteFriendsToCommunityPopup
|
|
||||||
InviteFriendsToCommunityPopup {
|
|
||||||
anchors.centerIn: parent
|
|
||||||
rootStore: root.rootStore
|
|
||||||
contactsStore: root.rootStore.contactsStore
|
|
||||||
onClosed: () => {
|
|
||||||
destroy();
|
|
||||||
}
|
|
||||||
|
|
||||||
onSendInvites: (pubKeys, inviteMessage) => {
|
|
||||||
const error = root.chatCommunitySectionModule.inviteUsersToCommunity(JSON.stringify(pubKeys), inviteMessage);
|
|
||||||
processInviteResult(error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,11 +68,8 @@ SettingsContentBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
onInviteFriends: {
|
onInviteFriends: {
|
||||||
Global.openPopup(inviteFriendsToCommunityPopup, {
|
Global.openInviteFriendsToCommunityPopup(communityData,
|
||||||
community: communityData,
|
root.profileSectionStore.communitiesProfileModule)
|
||||||
hasAddedContacts: root.contactStore.myContactsModel.count > 0,
|
|
||||||
communitySectionModule: root.profileSectionStore.communitiesProfileModule
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,19 +84,4 @@ SettingsContentBase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
property Component inviteFriendsToCommunityPopup: InviteFriendsToCommunityPopup {
|
|
||||||
anchors.centerIn: parent
|
|
||||||
rootStore: root.rootStore
|
|
||||||
contactsStore: root.contactStore
|
|
||||||
onClosed: () => {
|
|
||||||
destroy();
|
|
||||||
}
|
|
||||||
|
|
||||||
onSendInvites: {
|
|
||||||
const error = root.profileSectionStore.communitiesProfileModule.inviteUsersToCommunity(
|
|
||||||
community.id, JSON.stringify(pubKeys), inviteMessage);
|
|
||||||
processInviteResult(error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} // ScrollView
|
} // ScrollView
|
||||||
|
|
|
@ -320,11 +320,10 @@ Item {
|
||||||
text: qsTr("Invite People")
|
text: qsTr("Invite People")
|
||||||
icon.name: "share-ios"
|
icon.name: "share-ios"
|
||||||
enabled: model.canManageUsers
|
enabled: model.canManageUsers
|
||||||
onTriggered: Global.openPopup(inviteFriendsToCommunityPopup, {
|
onTriggered: {
|
||||||
community: model,
|
Global.openInviteFriendsToCommunityPopup(model,
|
||||||
hasAddedContacts: appMain.rootStore.hasAddedContacts,
|
communityContextMenu.chatCommunitySectionModule)
|
||||||
communitySectionModule: communityContextMenu.chatCommunitySectionModule
|
}
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
StatusMenuItem {
|
StatusMenuItem {
|
||||||
|
@ -857,23 +856,6 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Component {
|
|
||||||
id: inviteFriendsToCommunityPopup
|
|
||||||
InviteFriendsToCommunityPopup {
|
|
||||||
anchors.centerIn: parent
|
|
||||||
rootStore: appMain.rootStore
|
|
||||||
contactsStore: appMain.rootStore.contactStore
|
|
||||||
onClosed: () => {
|
|
||||||
destroy();
|
|
||||||
}
|
|
||||||
|
|
||||||
onSendInvites: (pubKeys, inviteMessage) => {
|
|
||||||
const error = communitySectionModule.inviteUsersToCommunity(JSON.stringify(pubKeys), inviteMessage);
|
|
||||||
processInviteResult(error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Component {
|
Component {
|
||||||
id: communityProfilePopup
|
id: communityProfilePopup
|
||||||
|
|
||||||
|
@ -1183,7 +1165,6 @@ Item {
|
||||||
Global.appMain = this;
|
Global.appMain = this;
|
||||||
Global.pinnedMessagesPopup = pinnedMessagesPopupComponent;
|
Global.pinnedMessagesPopup = pinnedMessagesPopupComponent;
|
||||||
Global.communityProfilePopup = communityProfilePopup;
|
Global.communityProfilePopup = communityProfilePopup;
|
||||||
Global.inviteFriendsToCommunityPopup = inviteFriendsToCommunityPopup;
|
|
||||||
const whitelist = appMain.rootStore.messagingStore.getLinkPreviewWhitelist()
|
const whitelist = appMain.rootStore.messagingStore.getLinkPreviewWhitelist()
|
||||||
try {
|
try {
|
||||||
const whiteListedSites = JSON.parse(whitelist)
|
const whiteListedSites = JSON.parse(whitelist)
|
||||||
|
|
|
@ -67,16 +67,24 @@ Item {
|
||||||
|
|
||||||
visible: {
|
visible: {
|
||||||
if (contactCheckbox.checked)
|
if (contactCheckbox.checked)
|
||||||
return true;
|
return true
|
||||||
|
|
||||||
return model.isContact && !model.isBlocked && (root.filterText === "" ||
|
if (!model.isContact || model.isBlocked)
|
||||||
root.matchesAlias(model.alias.toLowerCase(), root.filterText.toLowerCase()) ||
|
return false
|
||||||
model.displayName.toLowerCase().includes(root.filterText.toLowerCase()) ||
|
|
||||||
model.ensName.toLowerCase().includes(root.filterText.toLowerCase()) ||
|
const filter = root.filterText.toLowerCase()
|
||||||
model.localNickname.toLowerCase().includes(root.filterText.toLowerCase()) ||
|
const filterAccepted = root.filterText === ""
|
||||||
model.pubKey.toLowerCase().includes(root.filterText.toLowerCase())) &&
|
|| root.matchesAlias(model.alias.toLowerCase(), filter)
|
||||||
(!root.hideCommunityMembers ||
|
|| model.displayName.toLowerCase().includes(filter)
|
||||||
!root.rootStore.communityHasMember(root.communityId, model.pubKey));
|
|| model.ensName.toLowerCase().includes(filter)
|
||||||
|
|| model.localNickname.toLowerCase().includes(filter)
|
||||||
|
|| model.pubKey.toLowerCase().includes(filter)
|
||||||
|
|
||||||
|
if (!filterAccepted)
|
||||||
|
return false
|
||||||
|
|
||||||
|
return !root.hideCommunityMembers ||
|
||||||
|
!root.rootStore.communityHasMember(root.communityId, model.pubKey)
|
||||||
}
|
}
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
|
|
|
@ -54,8 +54,9 @@ Item {
|
||||||
status: model.onlineStatus
|
status: model.onlineStatus
|
||||||
userName: model.displayName
|
userName: model.displayName
|
||||||
asset.name: model.icon
|
asset.name: model.icon
|
||||||
asset.isImage: (asset.name !== "")
|
asset.isImage: asset.name !== ""
|
||||||
asset.isLetterIdenticon: (asset.name === "")
|
asset.isLetterIdenticon: asset.name === ""
|
||||||
|
asset.imgIsIdenticon: false
|
||||||
asset.width: 40
|
asset.width: 40
|
||||||
asset.height: 40
|
asset.height: 40
|
||||||
color: "transparent"
|
color: "transparent"
|
||||||
|
|
|
@ -53,6 +53,13 @@ Item {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function openInviteFriendsToCommunityPopup(community, communitySectionModule) {
|
||||||
|
return openPopup(inviteFriendsToCommunityPopup, {
|
||||||
|
community,
|
||||||
|
communitySectionModule
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
function openProfilePopup(publicKey, parentPopup, state = "") {
|
function openProfilePopup(publicKey, parentPopup, state = "") {
|
||||||
openProfilePopupRequested(publicKey, parentPopup, state);
|
openProfilePopupRequested(publicKey, parentPopup, state);
|
||||||
}
|
}
|
||||||
|
@ -128,10 +135,24 @@ Item {
|
||||||
|
|
||||||
Component {
|
Component {
|
||||||
id: sendContactRequestPopupComponent
|
id: sendContactRequestPopupComponent
|
||||||
|
|
||||||
SendContactRequestModal {
|
SendContactRequestModal {
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
onAccepted: appMain.rootStore.profileSectionStore.contactsStore.sendContactRequest(userPublicKey, message)
|
onAccepted: appMain.rootStore.profileSectionStore.contactsStore.sendContactRequest(userPublicKey, message)
|
||||||
onClosed: destroy()
|
onClosed: destroy()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Component {
|
||||||
|
id: inviteFriendsToCommunityPopup
|
||||||
|
|
||||||
|
InviteFriendsToCommunityPopup {
|
||||||
|
anchors.centerIn: parent
|
||||||
|
rootStore: appMain.rootStore
|
||||||
|
contactsStore: appMain.rootStore.contactStore
|
||||||
|
onClosed: {
|
||||||
|
destroy()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue