From 1bb19ba1de7402cd793d5be752d662abc40ac42b Mon Sep 17 00:00:00 2001 From: Stefan Date: Wed, 13 Apr 2022 22:54:17 +0200 Subject: [PATCH] fix(CommunityArchive): add community archive support to the new edit view --- .../communities/CommunityEditSettingsPanel.qml | 13 ++++--------- .../communities/CommunityOverviewSettingsPanel.qml | 14 +++++++++++++- .../Chat/views/CommunitySettingsView.qml | 3 +++ 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/ui/app/AppLayouts/Chat/panels/communities/CommunityEditSettingsPanel.qml b/ui/app/AppLayouts/Chat/panels/communities/CommunityEditSettingsPanel.qml index 99cae50a4c..9fac499a1a 100644 --- a/ui/app/AppLayouts/Chat/panels/communities/CommunityEditSettingsPanel.qml +++ b/ui/app/AppLayouts/Chat/panels/communities/CommunityEditSettingsPanel.qml @@ -28,6 +28,8 @@ Flickable { readonly property alias imageAy: imageCropperModal.aY readonly property alias imageBx: imageCropperModal.bX readonly property alias imageBy: imageCropperModal.bY + property bool isCommunityHistoryArchiveSupportEnabled: false + property alias historyArchiveSupportToggle: historyArchiveSupportToggle.checked contentWidth: layout.width contentHeight: layout.height @@ -249,18 +251,11 @@ Flickable { } StatusListItem { + title: qsTr("Community history service") + Layout.fillWidth: true - - title: qsTr("History Archive Support") - visible: root.isCommunityHistoryArchiveSupportEnabled - sensor.onClicked: { - if (root.isCommunityHistoryArchiveSupportEnabled) { - historyArchiveSupportToggle.checked = !historyArchiveSupportToggle.checked - } - } - components: [ StatusSwitch { id: historyArchiveSupportToggle diff --git a/ui/app/AppLayouts/Chat/panels/communities/CommunityOverviewSettingsPanel.qml b/ui/app/AppLayouts/Chat/panels/communities/CommunityOverviewSettingsPanel.qml index f33e11da41..36deecdf2c 100644 --- a/ui/app/AppLayouts/Chat/panels/communities/CommunityOverviewSettingsPanel.qml +++ b/ui/app/AppLayouts/Chat/panels/communities/CommunityOverviewSettingsPanel.qml @@ -9,6 +9,11 @@ import StatusQ.Components 0.1 import "../../layouts" +/*! TODO: very confusing to be refactored + The "API" properties are just for input purpose to and to track the inital state + that will be used in evaluating the dirty flag. They should not be updated based + on the user input. The final values are accessed through the \c item member of \c edit property + */ StackLayout { id: root @@ -18,6 +23,8 @@ StackLayout { property color color property bool editable: false property bool owned: false + property bool isCommunityHistoryArchiveSupportEnabled: false + property bool historyArchiveSupportToggle: false signal edited(Item item) // item containing edited fields (name, description, image, color) @@ -120,10 +127,14 @@ StackLayout { title: qsTr("Edit Community") content: CommunityEditSettingsPanel { + id: communityEditSettingsPanel + name: root.name description: root.description color: root.color image: root.image + isCommunityHistoryArchiveSupportEnabled: root.isCommunityHistoryArchiveSupportEnabled + historyArchiveSupportToggle: root.historyArchiveSupportToggle Component.onCompleted: { editCommunityPage.dirty = @@ -131,7 +142,8 @@ StackLayout { return root.name != name || root.description != description || root.image != image || - root.color != color + root.color != color || + root.historyArchiveSupportToggle !== historyArchiveSupportToggle }) } } diff --git a/ui/app/AppLayouts/Chat/views/CommunitySettingsView.qml b/ui/app/AppLayouts/Chat/views/CommunitySettingsView.qml index a5bca36ea1..8323fa62d2 100644 --- a/ui/app/AppLayouts/Chat/views/CommunitySettingsView.qml +++ b/ui/app/AppLayouts/Chat/views/CommunitySettingsView.qml @@ -119,6 +119,8 @@ StatusAppTwoPanelLayout { image: root.community.image color: root.community.color editable: root.community.amISectionAdmin + isCommunityHistoryArchiveSupportEnabled: root.rootStore.isCommunityHistoryArchiveSupportEnabled + historyArchiveSupportToggle: community.historyArchiveSupportEnabled onEdited: { root.chatCommunitySectionModule.editCommunity( @@ -132,6 +134,7 @@ StatusAppTwoPanelLayout { item.imageBx, item.imageBy, root.rootStore.isCommunityHistoryArchiveSupportEnabled, + false /*TODO port the modal implementation*/ ) } }