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,24 +44,19 @@ SplitView {
SplitView.preferredHeight: 150
logsView.logText: logs.logText
}
}
Pane {
SplitView.preferredWidth: 300
SplitView.fillHeight: true
ColumnLayout {
Switch {
id: controlNodeSwitch
text: "Control node on/off"
checked: true
}
ColumnLayout {
Switch {
id: controlNodeSwitch
text: "Control node on/off"
checked: true
}
Switch {
id: pendingOwnershipSwitch
text: "Is there a pending transfer ownership request?"
checked: true
Switch {
id: pendingOwnershipSwitch
text: "Is there a pending transfer ownership request?"
checked: true
}
}
}
}

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 {
CommunityInfoEditor{
id: communityEditor
anchors.fill: parent
}
ScrollView {
anchors.fill: parent
contentWidth: availableWidth
Switch {
id: pendingOwnershipSwitch
text: "Is there a pending transfer ownership request?"
checked: true
CommunityInfoEditor {
id: communityEditor
Switch {
id: pendingOwnershipSwitch
text: "Pending transfer ownership request?"
}
Switch {
id: ctrlIsAdmin
text: "Is admin?"
}
Switch {
id: ctrlIsTM
text: "Is token master?"
}
}
}
}

View File

@ -13,7 +13,7 @@ import utils 1.0
Control {
id: root
property bool isControlNode: true
property bool isControlNode: true
property string communityName: ""
property string communityColor: ""

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