fix(CommunitySettingsView): hide control node functionality for admins and token masters

- hide the footer when the user is an admin or token master, unless
there is a pending ownership request (`isPendingOwnershipRequest`)
- similarly, hide the sharding section in `CommunityInfoEditor`
- do not cover the shard button with the `SettingsDirtyToastMessage`
- some SB page cleanups and additions
This commit is contained in:
Lukáš Tinkl 2024-04-17 15:25:45 +02:00 committed by Lukáš Tinkl
parent 559f94a706
commit 6260519e66
7 changed files with 61 additions and 31 deletions

View File

@ -20,7 +20,7 @@ ColumnLayout {
readonly property bool shardingEnabled: ctrlShardingEnabled.checked
property alias shardIndex: ctrlShardIndex.value
spacing: 24
spacing: 12
ColumnLayout {
Label {

View File

@ -44,12 +44,6 @@ SplitView {
SplitView.preferredHeight: 150
logsView.logText: logs.logText
}
}
Pane {
SplitView.preferredWidth: 300
SplitView.fillHeight: true
ColumnLayout {
Switch {
@ -66,6 +60,7 @@ SplitView {
}
}
}
}
// category: Panels

View File

@ -2,12 +2,19 @@ import QtQuick 2.14
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15
import mainui 1.0
import AppLayouts.Communities.panels 1.0
SplitView {
id: root
SplitView.fillWidth: true
Popups {
popupParent: root
rootStore: QtObject {}
communityTokensStore: QtObject {}
}
OverviewSettingsPanel {
SplitView.fillWidth: true
SplitView.fillHeight: true
@ -18,8 +25,11 @@ SplitView {
color: communityEditor.color
bannerImageData: communityEditor.banner
editable: communityEditor.isCommunityEditable
isOwner: communityEditor.amISectionAdmin
isAdmin: ctrlIsAdmin.checked
isTokenMaster: ctrlIsTM.checked
editable: communityEditor.isCommunityEditable
communitySettingsDisabled: !editable
shardingEnabled: communityEditor.shardingEnabled
@ -32,16 +42,27 @@ SplitView {
SplitView.minimumWidth: 300
SplitView.preferredWidth: 300
ColumnLayout {
ScrollView {
anchors.fill: parent
contentWidth: availableWidth
CommunityInfoEditor {
id: communityEditor
anchors.fill: parent
}
Switch {
id: pendingOwnershipSwitch
text: "Is there a pending transfer ownership request?"
checked: true
text: "Pending transfer ownership request?"
}
Switch {
id: ctrlIsAdmin
text: "Is admin?"
}
Switch {
id: ctrlIsTM
text: "Is token master?"
}
}
}
}

View File

@ -22,6 +22,9 @@ StackLayout {
id: root
required property bool isOwner
required property bool isAdmin
required property bool isTokenMaster
property string communityId
property string name
property string description
@ -176,7 +179,7 @@ StackLayout {
Rectangle {
Layout.fillWidth: true
visible: mainSettingsPage.footer.active
implicitHeight: 1
color: Theme.palette.statusMenu.separatorColor
}
@ -223,6 +226,7 @@ StackLayout {
}
SettingsPage {
id: mainSettingsPage
Layout.fillWidth: !root.communitySettingsDisabled
Layout.preferredWidth: root.communitySettingsDisabled ? 560 + leftPadding + rightPadding : -1
Layout.fillHeight: !root.communitySettingsDisabled
@ -236,7 +240,13 @@ StackLayout {
footer: Loader {
sourceComponent: overviewSettingsFooterComp
active: !root.communitySettingsDisabled
active: {
if (root.communitySettingsDisabled)
return false
if (root.isAdmin || root.isTokenMaster)
return root.isPendingOwnershipRequest // not allowed for admin or TM unless there's the pending request
return true
}
}
}
@ -329,6 +339,7 @@ StackLayout {
active: !!editSettingsPanelLoader.item &&
editSettingsPanelLoader.item.dirty
visible: active
saveChangesButtonEnabled:
!!editSettingsPanelLoader.item &&

View File

@ -82,6 +82,7 @@ StatusDialog {
ConfirmationDialog {
id: confirmationPopup
width: root.width - root.margins
anchors.centerIn: parent
headerSettings.title: qsTr("Are you sure you want to disable sharding?")
showCancelButton: true

View File

@ -168,6 +168,8 @@ StatusSectionLayout {
readonly property bool sectionEnabled: true
isOwner: root.isOwner
isAdmin: root.isAdmin
isTokenMaster: root.isTokenMasterOwner
communityId: root.community.id
name: root.community.name
description: root.community.description
@ -187,7 +189,7 @@ StatusSectionLayout {
isControlNode: root.isControlNode
communitySettingsDisabled: root.communitySettingsDisabled
overviewChartData: rootStore.overviewChartData
shardingEnabled: localAppSettings.wakuV2ShardedCommunitiesEnabled ?? false
shardingEnabled: !isAdmin && !isTokenMaster && localAppSettings.wakuV2ShardedCommunitiesEnabled
shardIndex: root.community.shardIndex
shardingInProgress: root.chatCommunitySectionModule.shardingInProgress
pubsubTopic: root.community.pubsubTopic