From 2e710715bc285dbd9c6fac354c43f3bf328f5b33 Mon Sep 17 00:00:00 2001 From: Pascal Precht Date: Tue, 9 Mar 2021 14:25:00 +0100 Subject: [PATCH] fix(Communities): ensure profile popup is hydrated with correct data The `communityProfilePopup` relies on the currently `activeCommunity` to get its data. Unfortunately, once read, even when `chatsModel.setActiveCommunity()` is called which triggers `activeCommunityChanged`, the data in the popup won't be updated. The next time one would open a community profile page, it'd have the data that was previously received from the model. This commit ensures that the popup is hydrated with the most recent data by explicitly updating its properties right before it's opened. --- .../Chat/CommunityComponents/CommunityHeaderButton.qml | 9 ++++++++- .../Chat/CommunityComponents/CommunityWelcomeBanner.qml | 9 ++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/ui/app/AppLayouts/Chat/CommunityComponents/CommunityHeaderButton.qml b/ui/app/AppLayouts/Chat/CommunityComponents/CommunityHeaderButton.qml index 79f421e0eb..60270456f9 100644 --- a/ui/app/AppLayouts/Chat/CommunityComponents/CommunityHeaderButton.qml +++ b/ui/app/AppLayouts/Chat/CommunityComponents/CommunityHeaderButton.qml @@ -56,7 +56,14 @@ Button { visible: enabled cursorShape: Qt.PointingHandCursor anchors.fill: parent - onPressed: communityProfilePopup.open(); + onPressed: { + communityProfilePopup.communityId = chatsModel.communities.activeCommunity.id; + communityProfilePopup.name = chatsModel.communities.activeCommunity.name; + communityProfilePopup.description = chatsModel.communities.activeCommunity.description; + communityProfilePopup.access = chatsModel.communities.activeCommunity.access; + communityProfilePopup.nbMembers = chatsModel.communities.activeCommunity.nbMembers; + communityProfilePopup.open(); + } hoverEnabled: true onExited: { btnBackground.color = Style.current.transparent diff --git a/ui/app/AppLayouts/Chat/CommunityComponents/CommunityWelcomeBanner.qml b/ui/app/AppLayouts/Chat/CommunityComponents/CommunityWelcomeBanner.qml index e3e391b9fa..3a4b6d4a98 100644 --- a/ui/app/AppLayouts/Chat/CommunityComponents/CommunityWelcomeBanner.qml +++ b/ui/app/AppLayouts/Chat/CommunityComponents/CommunityWelcomeBanner.qml @@ -86,6 +86,13 @@ Rectangle { anchors.horizontalCenter: parent.horizontalCenter anchors.bottom: parent.bottom anchors.bottomMargin: Style.current.padding - onClicked: communityProfilePopup.open() + onClicked: { + communityProfilePopup.communityId = chatsModel.communities.activeCommunity.id; + communityProfilePopup.name = chatsModel.communities.activeCommunity.name; + communityProfilePopup.description = chatsModel.communities.activeCommunity.description; + communityProfilePopup.access = chatsModel.communities.activeCommunity.access; + communityProfilePopup.nbMembers = chatsModel.communities.activeCommunity.nbMembers; + communityProfilePopup.open() + } } }