From 42b10783efed01dfe5fbc620cbed6a65360c32a3 Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Thu, 30 May 2024 09:52:28 -0400 Subject: [PATCH] fix: ensure communityDetails are updated in PermissionsView (#14981) Fixed an issue where communityDetails were not being updated in PermissionsView. This issue was causing the name, color, and image not to update correctly. Co-authored-by: mdias --- .../Communities/views/PermissionsView.qml | 34 ++++++++++++++----- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/ui/app/AppLayouts/Communities/views/PermissionsView.qml b/ui/app/AppLayouts/Communities/views/PermissionsView.qml index 30433c7e15..05ba8ed216 100644 --- a/ui/app/AppLayouts/Communities/views/PermissionsView.qml +++ b/ui/app/AppLayouts/Communities/views/PermissionsView.qml @@ -31,7 +31,7 @@ ColumnLayout { required property var channelsModel // id, name, image, color, owner, admin properties expected - required property var communityDetails + required property QtObject communityDetails property int viewWidth: 560 // by design property bool viewOnlyCanAddReaction @@ -44,16 +44,32 @@ ColumnLayout { signal userRestrictionsToggled(bool checked) readonly property alias count: repeater.count + + Connections { + target: root.communityDetails + function onNameChanged(){ + resetCommunityItemModel() + } + function onImageChanged(){ + resetCommunityItemModel() + } + function onColorChanged(){ + resetCommunityItemModel() + } + } + + function resetCommunityItemModel(){ + communityItemModel.clear() + communityItemModel.append({ + text: root.communityDetails.name, + imageSource: root.communityDetails.image, + color: root.communityDetails.color + }) + } + ListModel { id: communityItemModel - - Component.onCompleted: { - append({ - text: root.communityDetails.name, - imageSource: root.communityDetails.image, - color: root.communityDetails.color - }) - } + Component.onCompleted: resetCommunityItemModel() } IntroPanel {