fix(@desktop/chat): intermittent with community invites

Fixes: #6170
This commit is contained in:
Sale Djenic 2022-06-21 13:44:20 +02:00 committed by Iuri Matias
parent 5feef166f8
commit 22d5f2d126
6 changed files with 24 additions and 17 deletions

View File

@ -6,6 +6,7 @@ import utils 1.0
import "views"
import "stores"
import "popups/community"
StackLayout {
id: root
@ -19,10 +20,23 @@ StackLayout {
clip: true
Component {
id: membershipRequestPopupComponent
MembershipRequestsPopup {
anchors.centerIn: parent
store: root.rootStore
communityData: store.mainModuleInst ? store.mainModuleInst.activeSection || {} : {}
onClosed: {
destroy()
}
}
}
ChatView {
id: chatView
contactsStore: root.contactsStore
rootStore: root.rootStore
membershipRequestPopup: membershipRequestPopupComponent
onCommunityInfoButtonClicked: root.currentIndex = 1
onCommunityManageButtonClicked: root.currentIndex = 1
@ -32,6 +46,7 @@ StackLayout {
active: root.rootStore.chatCommunitySectionModule.isCommunity()
sourceComponent: CommunitySettingsView {
membershipRequestPopup: membershipRequestPopupComponent
rootStore: root.rootStore
hasAddedContacts: root.contactsStore.myContactsModel.count > 0
chatCommunitySectionModule: root.rootStore.chatCommunitySectionModule

View File

@ -41,7 +41,7 @@ StatusModal {
//% "Invite friends"
header.title: qsTrId("invite-friends")
function proccesInviteResult(error) {
function processInviteResult(error) {
if (error) {
console.error('Error inviting', error)
contactFieldAndList.validationError = error

View File

@ -15,7 +15,7 @@ StatusModal {
id: popup
property var store
property var communitySectionModule
property var pendingRequestsToJoin
property var communityData
onOpened: {
contentItem.errorText.text = ""
}
@ -55,7 +55,7 @@ StatusModal {
ListView {
id: membershipRequestList
anchors.fill: parent
model: popup.pendingRequestsToJoin
model: popup.communityData.pendingRequestsToJoin
clip: true
delegate: StatusListItem {

View File

@ -29,6 +29,7 @@ StatusAppThreePanelLayout {
property RootStore rootStore
property Component pinnedMessagesListPopupComponent
property Component membershipRequestPopup
property var emojiPopup
property bool stickersLoaded: false
@ -138,6 +139,7 @@ StatusAppThreePanelLayout {
emojiPopup: root.emojiPopup
hasAddedContacts: root.hasAddedContacts
pinnedMessagesPopupComponent: root.pinnedMessagesListPopupComponent
membershipRequestPopup: root.membershipRequestPopup
onInfoButtonClicked: root.communityInfoButtonClicked()
onManageButtonClicked: root.communityManageButtonClicked()
}

View File

@ -30,6 +30,7 @@ Item {
property bool hasAddedContacts: false
property var communityData: store.mainModuleInst ? store.mainModuleInst.activeSection || {} : {}
property Component pinnedMessagesPopupComponent
property Component membershipRequestPopup
signal infoButtonClicked
signal manageButtonClicked
@ -100,7 +101,7 @@ Item {
//% "Membership requests"
title: qsTrId("membership-requests")
requestsCount: membershipRequests.nbRequests
sensor.onClicked: Global.openPopup(membershipRequestPopup, {
sensor.onClicked: Global.openPopup(root.membershipRequestPopup, {
communitySectionModule: root.communitySectionModule
})
}
@ -523,18 +524,6 @@ Item {
standardButtons: StandardButton.Ok
}
Component {
id: membershipRequestPopup
MembershipRequestsPopup {
anchors.centerIn: parent
store: root.store
pendingRequestsToJoin: root.communityData.pendingRequestsToJoin
onClosed: {
destroy()
}
}
}
Component {
id: transferOwnershipPopup
TransferOwnershipPopup {

View File

@ -36,6 +36,7 @@ StatusAppTwoPanelLayout {
property var community
property var chatCommunitySectionModule
property bool hasAddedContacts: false
property Component membershipRequestPopup
signal backToCommunityClicked
signal openLegacyPopupClicked // TODO: remove me when migration to new settings is done
@ -174,7 +175,7 @@ StatusAppTwoPanelLayout {
onUserProfileClicked: Global.openProfilePopup(id)
onKickUserClicked: root.rootStore.removeUserFromCommunity(id)
onBanUserClicked: root.rootStore.banUserFromCommunity(id)
onMembershipRequestsClicked: Global.openPopup(membershipRequestPopup, {
onMembershipRequestsClicked: Global.openPopup(root.membershipRequestPopup, {
communitySectionModule: root.chatCommunitySectionModule
})
}