From 80975c80a26543540ee13a798ab9b37e2d429cc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Tinkl?= Date: Mon, 11 Dec 2023 10:47:30 +0100 Subject: [PATCH] fix(CommunitiesView): display proper member count turns out the model from the comminitiesModule doesn't contain the members; use the sectionModel (as in all other places) instead which already has the correct info additionally, fix the InviteFriendsToCommunityPopup display, it appeared empty all the time Fixes #12967 --- storybook/pages/CommunitiesViewPage.qml | 2 +- .../InviteFriendsToCommunityPopupPage.qml | 21 +++++++++++- .../popups/InviteFriendsToCommunityPopup.qml | 33 ++++++------------- .../Profile/stores/ProfileSectionStore.qml | 10 +++++- 4 files changed, 40 insertions(+), 26 deletions(-) diff --git a/storybook/pages/CommunitiesViewPage.qml b/storybook/pages/CommunitiesViewPage.qml index a761eb50e3..1a90d9345c 100644 --- a/storybook/pages/CommunitiesViewPage.qml +++ b/storybook/pages/CommunitiesViewPage.qml @@ -155,7 +155,7 @@ SplitView { property var communitiesList: ctrlEmptyView.checked ? emptyModel : communitiesModel } rootStore: QtObject { - function isCommunityRequestPending(communityId) { + function isMyCommunityRequestPending(communityId) { return communityId === "0x0006" } function cancelPendingRequest(communityId) { diff --git a/storybook/pages/InviteFriendsToCommunityPopupPage.qml b/storybook/pages/InviteFriendsToCommunityPopupPage.qml index 51918a3e77..0add803a1c 100644 --- a/storybook/pages/InviteFriendsToCommunityPopupPage.qml +++ b/storybook/pages/InviteFriendsToCommunityPopupPage.qml @@ -13,6 +13,7 @@ SplitView { property bool globalUtilsReady: false property bool mainModuleReady: false + property bool communitiesModuleReady: false Item { @@ -44,6 +45,9 @@ SplitView { {colorId: 19, segmentLength: 2}]) } + function copyToClipboard(text) { + } + Component.onCompleted: { Utils.globalUtilsInst = this globalUtilsReady = true @@ -70,9 +74,24 @@ SplitView { } } + QtObject { + function shareCommunityUrlWithData(communityId) { + return "status-app:/"+communityId + } + + Component.onCompleted: { + communitiesModuleReady = true + Utils.communitiesModuleInst = this + } + Component.onDestruction: { + communitiesModuleReady = false + Utils.communitiesModuleInst = {} + } + } + Loader { id: loader - active: globalUtilsReady && mainModuleReady + active: globalUtilsReady && mainModuleReady && communitiesModuleReady anchors.fill: parent sourceComponent: InviteFriendsToCommunityPopup { diff --git a/ui/app/AppLayouts/Communities/popups/InviteFriendsToCommunityPopup.qml b/ui/app/AppLayouts/Communities/popups/InviteFriendsToCommunityPopup.qml index 2ae29251bf..b94c7d3558 100644 --- a/ui/app/AppLayouts/Communities/popups/InviteFriendsToCommunityPopup.qml +++ b/ui/app/AppLayouts/Communities/popups/InviteFriendsToCommunityPopup.qml @@ -54,8 +54,8 @@ StatusStackModal { stackTitle: qsTr("Invite Contacts to %1").arg(community.name) width: 640 + height: d.popupContentHeight - padding: 0 leftPadding: 0 rightPadding: 0 @@ -90,30 +90,17 @@ StatusStackModal { } stackItems: [ - Item { - implicitHeight: d.popupContentHeight - - ProfilePopupInviteFriendsPanel { - anchors.fill: parent - anchors.topMargin: 16 - anchors.bottomMargin: 16 - - rootStore: root.rootStore - contactsStore: root.contactsStore - community: root.community - onPubKeysChanged: root.pubKeys = pubKeys - } + ProfilePopupInviteFriendsPanel { + rootStore: root.rootStore + contactsStore: root.contactsStore + community: root.community + onPubKeysChanged: root.pubKeys = pubKeys }, - Item { - ProfilePopupInviteMessagePanel { - anchors.fill: parent - anchors.topMargin: 16 - - contactsStore: root.contactsStore - pubKeys: root.pubKeys - onInviteMessageChanged: root.inviteMessage = inviteMessage - } + ProfilePopupInviteMessagePanel { + contactsStore: root.contactsStore + pubKeys: root.pubKeys + onInviteMessageChanged: root.inviteMessage = inviteMessage } ] } diff --git a/ui/app/AppLayouts/Profile/stores/ProfileSectionStore.qml b/ui/app/AppLayouts/Profile/stores/ProfileSectionStore.qml index f04c527659..298570a2b8 100644 --- a/ui/app/AppLayouts/Profile/stores/ProfileSectionStore.qml +++ b/ui/app/AppLayouts/Profile/stores/ProfileSectionStore.qml @@ -3,6 +3,8 @@ import utils 1.0 import AppLayouts.Chat.stores 1.0 +import SortFilterProxyModel 0.2 + QtObject { id: root @@ -73,7 +75,13 @@ QtObject { property bool walletMenuItemEnabled: profileStore.isWalletEnabled property var communitiesModuleInst: Global.appIsReady? communitiesModule : null - property var communitiesList: !!communitiesModuleInst? communitiesModuleInst.model : null + property var communitiesList: SortFilterProxyModel { + sourceModel: root.mainModuleInst.sectionsModel + filters: ValueFilter { + roleName: "sectionType" + value: Constants.appSection.community + } + } property var communitiesProfileModule: profileSectionModuleInst.communitiesModule property ListModel mainMenuItems: ListModel {