chore(CommunityPermissions): Adjust behavior of 'Hide permission' switch depending on selected permission
Closes: #9050
This commit is contained in:
parent
5c3b9881c5
commit
63a0f51305
|
@ -4,51 +4,76 @@ import QtQuick.Controls 2.14
|
|||
import AppLayouts.Chat.views.communities 1.0
|
||||
import AppLayouts.Chat.stores 1.0
|
||||
|
||||
import Storybook 1.0
|
||||
import Models 1.0
|
||||
|
||||
Pane {
|
||||
id: root
|
||||
SplitView {
|
||||
orientation: Qt.Vertical
|
||||
SplitView.fillWidth: true
|
||||
|
||||
CommunityNewPermissionView {
|
||||
Logs { id: logs }
|
||||
|
||||
store: CommunitiesStore {
|
||||
readonly property var assetsModel: AssetsModel {}
|
||||
readonly property var collectiblesModel: CollectiblesModel {}
|
||||
readonly property var channelsModel: ChannelsModel {}
|
||||
readonly property var permissionConflict: QtObject {
|
||||
property bool exists: true
|
||||
property string holdings: "1 ETH"
|
||||
property string permissions: "View and Post"
|
||||
property string channels: "#general"
|
||||
Pane {
|
||||
id: root
|
||||
|
||||
CommunityNewPermissionView {
|
||||
|
||||
store: CommunitiesStore {
|
||||
readonly property var assetsModel: AssetsModel {}
|
||||
readonly property var collectiblesModel: CollectiblesModel {}
|
||||
readonly property var channelsModel: ChannelsModel {}
|
||||
readonly property var permissionConflict: QtObject {
|
||||
property bool exists: true
|
||||
property string holdings: "1 ETH"
|
||||
property string permissions: "View and Post"
|
||||
property string channels: "#general"
|
||||
|
||||
}
|
||||
|
||||
readonly property bool isOwner: isOwnerCheckBox.checked
|
||||
|
||||
function editPermission(index, holdings, permissions, channels, isPrivate) {
|
||||
logs.logEvent("CommunitiesStore::editPermission - index: " + index)
|
||||
}
|
||||
|
||||
function duplicatePermission(index) {
|
||||
logs.logEvent("CommunitiesStore::duplicatePermission - index: " + index)
|
||||
}
|
||||
|
||||
function removePermission(index) {
|
||||
logs.logEvent("CommunitiesStore::removePermission - index: " + index)
|
||||
}
|
||||
}
|
||||
|
||||
function editPermission(index, holdings, permissions, channels, isPrivate) {
|
||||
logs.logEvent("CommunitiesStore::editPermission - index: " + index)
|
||||
}
|
||||
rootStore: QtObject {
|
||||
readonly property QtObject chatCommunitySectionModule: QtObject {
|
||||
readonly property var model: ChannelsModel {}
|
||||
}
|
||||
|
||||
function duplicatePermission(index) {
|
||||
logs.logEvent("CommunitiesStore::duplicatePermission - index: " + index)
|
||||
}
|
||||
readonly property QtObject mainModuleInst: QtObject {
|
||||
|
||||
function removePermission(index) {
|
||||
logs.logEvent("CommunitiesStore::removePermission - index: " + index)
|
||||
}
|
||||
}
|
||||
|
||||
rootStore: QtObject {
|
||||
readonly property QtObject chatCommunitySectionModule: QtObject {
|
||||
readonly property var model: ChannelsModel {}
|
||||
}
|
||||
|
||||
readonly property QtObject mainModuleInst: QtObject {
|
||||
|
||||
readonly property QtObject activeSection: QtObject {
|
||||
readonly property string name: "Socks"
|
||||
readonly property string image: ModelsData.icons.socks
|
||||
readonly property color color: "red"
|
||||
readonly property QtObject activeSection: QtObject {
|
||||
readonly property string name: "Socks"
|
||||
readonly property string image: ModelsData.icons.socks
|
||||
readonly property color color: "red"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LogsAndControlsPanel {
|
||||
id: logsAndControlsPanel
|
||||
|
||||
SplitView.minimumHeight: 100
|
||||
SplitView.preferredHeight: 150
|
||||
|
||||
logsView.logText: logs.logText
|
||||
|
||||
CheckBox {
|
||||
id: isOwnerCheckBox
|
||||
|
||||
text: "Is owner"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,86 +8,85 @@ import StatusQ.Core.Theme 0.1
|
|||
import Storybook 1.0
|
||||
import Models 1.0
|
||||
|
||||
|
||||
SplitView {
|
||||
orientation: Qt.Vertical
|
||||
SplitView.fillWidth: true
|
||||
|
||||
Logs { id: logs }
|
||||
|
||||
SplitView {
|
||||
orientation: Qt.Vertical
|
||||
Rectangle {
|
||||
SplitView.fillWidth: true
|
||||
SplitView.fillHeight: true
|
||||
color: Theme.palette.statusAppLayout.rightPanelBackgroundColor
|
||||
CommunityPermissionsSettingsPanel {
|
||||
anchors {
|
||||
fill: parent
|
||||
topMargin: 50
|
||||
}
|
||||
store: CommunitiesStore {
|
||||
readonly property bool isOwner: isOwnerCheckBox.checked
|
||||
|
||||
Rectangle {
|
||||
SplitView.fillWidth: true
|
||||
SplitView.fillHeight: true
|
||||
color: Theme.palette.statusAppLayout.rightPanelBackgroundColor
|
||||
CommunityPermissionsSettingsPanel {
|
||||
anchors {
|
||||
fill: parent
|
||||
topMargin: 50
|
||||
}
|
||||
store: CommunitiesStore {
|
||||
readonly property bool isOwner: isOwnerCheckBox.checked
|
||||
|
||||
assetsModel: AssetsModel {}
|
||||
collectiblesModel: CollectiblesModel {}
|
||||
channelsModel: ListModel {
|
||||
Component.onCompleted: {
|
||||
append([
|
||||
{
|
||||
key: "welcome",
|
||||
iconSource: ModelsData.assets.inch,
|
||||
name: "#welcome"
|
||||
},
|
||||
{
|
||||
key: "general",
|
||||
iconSource: ModelsData.assets.inch,
|
||||
name: "#general"
|
||||
}
|
||||
])
|
||||
}
|
||||
}
|
||||
|
||||
function editPermission(index, holdings, permissions, channels, isPrivate) {
|
||||
logs.logEvent("CommunitiesStore::editPermission - index: " + index)
|
||||
}
|
||||
|
||||
function duplicatePermission(index) {
|
||||
logs.logEvent("CommunitiesStore::duplicatePermission - index: " + index)
|
||||
}
|
||||
|
||||
function removePermission(index) {
|
||||
logs.logEvent("CommunitiesStore::removePermission - index: " + index)
|
||||
assetsModel: AssetsModel {}
|
||||
collectiblesModel: CollectiblesModel {}
|
||||
channelsModel: ListModel {
|
||||
Component.onCompleted: {
|
||||
append([
|
||||
{
|
||||
key: "welcome",
|
||||
iconSource: ModelsData.assets.inch,
|
||||
name: "#welcome"
|
||||
},
|
||||
{
|
||||
key: "general",
|
||||
iconSource: ModelsData.assets.inch,
|
||||
name: "#general"
|
||||
}
|
||||
])
|
||||
}
|
||||
}
|
||||
|
||||
rootStore: QtObject {
|
||||
readonly property QtObject chatCommunitySectionModule: QtObject {
|
||||
readonly property var model: ChannelsModel {}
|
||||
}
|
||||
function editPermission(index, holdings, permissions, channels, isPrivate) {
|
||||
logs.logEvent("CommunitiesStore::editPermission - index: " + index)
|
||||
}
|
||||
|
||||
readonly property QtObject mainModuleInst: QtObject {
|
||||
readonly property QtObject activeSection: QtObject {
|
||||
readonly property string name: "Socks"
|
||||
readonly property string image: ModelsData.icons.socks
|
||||
readonly property color color: "red"
|
||||
}
|
||||
}
|
||||
function duplicatePermission(index) {
|
||||
logs.logEvent("CommunitiesStore::duplicatePermission - index: " + index)
|
||||
}
|
||||
|
||||
function removePermission(index) {
|
||||
logs.logEvent("CommunitiesStore::removePermission - index: " + index)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LogsAndControlsPanel {
|
||||
id: logsAndControlsPanel
|
||||
rootStore: QtObject {
|
||||
readonly property QtObject chatCommunitySectionModule: QtObject {
|
||||
readonly property var model: ChannelsModel {}
|
||||
}
|
||||
|
||||
SplitView.minimumHeight: 100
|
||||
SplitView.preferredHeight: 150
|
||||
|
||||
logsView.logText: logs.logText
|
||||
|
||||
CheckBox {
|
||||
id: isOwnerCheckBox
|
||||
|
||||
text: "Is owner"
|
||||
readonly property QtObject mainModuleInst: QtObject {
|
||||
readonly property QtObject activeSection: QtObject {
|
||||
readonly property string name: "Socks"
|
||||
readonly property string image: ModelsData.icons.socks
|
||||
readonly property color color: "red"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LogsAndControlsPanel {
|
||||
id: logsAndControlsPanel
|
||||
|
||||
SplitView.minimumHeight: 100
|
||||
SplitView.preferredHeight: 150
|
||||
|
||||
logsView.logText: logs.logText
|
||||
|
||||
CheckBox {
|
||||
id: isOwnerCheckBox
|
||||
|
||||
text: "Is owner"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ StatusDropdown {
|
|||
property int mode: PermissionsDropdown.Mode.Add
|
||||
property int initialPermissionType: PermissionTypes.Type.None
|
||||
|
||||
property bool disableAdminPermission: false
|
||||
property bool enableAdminPermission: true
|
||||
|
||||
enum Mode {
|
||||
Add, Update
|
||||
|
@ -95,7 +95,7 @@ StatusDropdown {
|
|||
checked: d.initialPermissionType === permissionType
|
||||
buttonGroup: group
|
||||
|
||||
enabled: !root.disableAdminPermission
|
||||
enabled: root.enableAdminPermission
|
||||
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
@ -160,7 +160,7 @@ StatusDropdown {
|
|||
readonly property string description:
|
||||
qsTr("Members who meet the requirements will be allowed to read the selected channels")
|
||||
|
||||
title: qsTr("Read")
|
||||
title: qsTr("View only")
|
||||
asset.name: "show"
|
||||
checked: d.initialPermissionType === permissionType
|
||||
buttonGroup: group
|
||||
|
|
|
@ -81,6 +81,18 @@ StatusScrollView {
|
|||
permissionType === PermissionTypes.Type.Admin ||
|
||||
permissionType === PermissionTypes.Type.Member
|
||||
|
||||
onPermissionTypeChanged: {
|
||||
if (permissionType === PermissionTypes.Type.Admin) {
|
||||
d.dirtyValues.isPrivateDirty = (root.isPrivate === false)
|
||||
} else {
|
||||
if (permissionType === PermissionTypes.Type.Moderator) {
|
||||
d.dirtyValues.isPrivateDirty = (root.isPrivate === false)
|
||||
} else {
|
||||
d.dirtyValues.isPrivateDirty = (root.isPrivate === true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onIsCommunityPermissionChanged: {
|
||||
if (isCommunityPermission) {
|
||||
inModelChannels.clear()
|
||||
|
@ -431,7 +443,7 @@ StatusScrollView {
|
|||
id: permissionsDropdown
|
||||
|
||||
initialPermissionType: d.permissionType
|
||||
disableAdminPermission: !root.store.isOwner
|
||||
enableAdminPermission: root.store.isOwner
|
||||
|
||||
onDone: {
|
||||
if (d.permissionType === permissionType) {
|
||||
|
@ -594,14 +606,14 @@ StatusScrollView {
|
|||
ColumnLayout {
|
||||
Layout.fillWidth: true
|
||||
StatusBaseText {
|
||||
text: qsTr("Private")
|
||||
text: qsTr("Hide permission")
|
||||
color: Theme.palette.directColor1
|
||||
font.pixelSize: 15
|
||||
}
|
||||
StatusBaseText {
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
text: qsTr("Make this permission private to hide it from members who don’t meet it’s requirements")
|
||||
text: qsTr("Make this permission hidden from members who don’t meet it’s requirements")
|
||||
color: Theme.palette.baseColor1
|
||||
font.pixelSize: 15
|
||||
lineHeight: 1.2
|
||||
|
@ -611,6 +623,7 @@ StatusScrollView {
|
|||
}
|
||||
}
|
||||
StatusSwitch {
|
||||
enabled: d.permissionType !== PermissionTypes.Type.Admin
|
||||
checked: d.dirtyValues.isPrivateDirty ? !root.isPrivate : root.isPrivate
|
||||
onToggled: d.dirtyValues.isPrivateDirty = (root.isPrivate !== checked)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue