mirror of
https://github.com/status-im/status-desktop.git
synced 2025-02-18 01:27:25 +00:00
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.views.communities 1.0
|
||||||
import AppLayouts.Chat.stores 1.0
|
import AppLayouts.Chat.stores 1.0
|
||||||
|
|
||||||
|
import Storybook 1.0
|
||||||
import Models 1.0
|
import Models 1.0
|
||||||
|
|
||||||
Pane {
|
SplitView {
|
||||||
id: root
|
orientation: Qt.Vertical
|
||||||
|
SplitView.fillWidth: true
|
||||||
|
|
||||||
CommunityNewPermissionView {
|
Logs { id: logs }
|
||||||
|
|
||||||
store: CommunitiesStore {
|
Pane {
|
||||||
readonly property var assetsModel: AssetsModel {}
|
id: root
|
||||||
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"
|
|
||||||
|
|
||||||
|
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) {
|
rootStore: QtObject {
|
||||||
logs.logEvent("CommunitiesStore::editPermission - index: " + index)
|
readonly property QtObject chatCommunitySectionModule: QtObject {
|
||||||
}
|
readonly property var model: ChannelsModel {}
|
||||||
|
}
|
||||||
|
|
||||||
function duplicatePermission(index) {
|
readonly property QtObject mainModuleInst: QtObject {
|
||||||
logs.logEvent("CommunitiesStore::duplicatePermission - index: " + index)
|
|
||||||
}
|
|
||||||
|
|
||||||
function removePermission(index) {
|
readonly property QtObject activeSection: QtObject {
|
||||||
logs.logEvent("CommunitiesStore::removePermission - index: " + index)
|
readonly property string name: "Socks"
|
||||||
}
|
readonly property string image: ModelsData.icons.socks
|
||||||
}
|
readonly property color color: "red"
|
||||||
|
}
|
||||||
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"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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 Storybook 1.0
|
||||||
import Models 1.0
|
import Models 1.0
|
||||||
|
|
||||||
|
|
||||||
SplitView {
|
SplitView {
|
||||||
|
orientation: Qt.Vertical
|
||||||
|
SplitView.fillWidth: true
|
||||||
|
|
||||||
Logs { id: logs }
|
Logs { id: logs }
|
||||||
|
|
||||||
SplitView {
|
Rectangle {
|
||||||
orientation: Qt.Vertical
|
|
||||||
SplitView.fillWidth: true
|
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 {
|
assetsModel: AssetsModel {}
|
||||||
SplitView.fillWidth: true
|
collectiblesModel: CollectiblesModel {}
|
||||||
SplitView.fillHeight: true
|
channelsModel: ListModel {
|
||||||
color: Theme.palette.statusAppLayout.rightPanelBackgroundColor
|
Component.onCompleted: {
|
||||||
CommunityPermissionsSettingsPanel {
|
append([
|
||||||
anchors {
|
{
|
||||||
fill: parent
|
key: "welcome",
|
||||||
topMargin: 50
|
iconSource: ModelsData.assets.inch,
|
||||||
}
|
name: "#welcome"
|
||||||
store: CommunitiesStore {
|
},
|
||||||
readonly property bool isOwner: isOwnerCheckBox.checked
|
{
|
||||||
|
key: "general",
|
||||||
assetsModel: AssetsModel {}
|
iconSource: ModelsData.assets.inch,
|
||||||
collectiblesModel: CollectiblesModel {}
|
name: "#general"
|
||||||
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)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rootStore: QtObject {
|
function editPermission(index, holdings, permissions, channels, isPrivate) {
|
||||||
readonly property QtObject chatCommunitySectionModule: QtObject {
|
logs.logEvent("CommunitiesStore::editPermission - index: " + index)
|
||||||
readonly property var model: ChannelsModel {}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
readonly property QtObject mainModuleInst: QtObject {
|
function duplicatePermission(index) {
|
||||||
readonly property QtObject activeSection: QtObject {
|
logs.logEvent("CommunitiesStore::duplicatePermission - index: " + index)
|
||||||
readonly property string name: "Socks"
|
}
|
||||||
readonly property string image: ModelsData.icons.socks
|
|
||||||
readonly property color color: "red"
|
function removePermission(index) {
|
||||||
}
|
logs.logEvent("CommunitiesStore::removePermission - index: " + index)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
LogsAndControlsPanel {
|
rootStore: QtObject {
|
||||||
id: logsAndControlsPanel
|
readonly property QtObject chatCommunitySectionModule: QtObject {
|
||||||
|
readonly property var model: ChannelsModel {}
|
||||||
|
}
|
||||||
|
|
||||||
SplitView.minimumHeight: 100
|
readonly property QtObject mainModuleInst: QtObject {
|
||||||
SplitView.preferredHeight: 150
|
readonly property QtObject activeSection: QtObject {
|
||||||
|
readonly property string name: "Socks"
|
||||||
logsView.logText: logs.logText
|
readonly property string image: ModelsData.icons.socks
|
||||||
|
readonly property color color: "red"
|
||||||
CheckBox {
|
}
|
||||||
id: isOwnerCheckBox
|
}
|
||||||
|
|
||||||
text: "Is owner"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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 mode: PermissionsDropdown.Mode.Add
|
||||||
property int initialPermissionType: PermissionTypes.Type.None
|
property int initialPermissionType: PermissionTypes.Type.None
|
||||||
|
|
||||||
property bool disableAdminPermission: false
|
property bool enableAdminPermission: true
|
||||||
|
|
||||||
enum Mode {
|
enum Mode {
|
||||||
Add, Update
|
Add, Update
|
||||||
@ -95,7 +95,7 @@ StatusDropdown {
|
|||||||
checked: d.initialPermissionType === permissionType
|
checked: d.initialPermissionType === permissionType
|
||||||
buttonGroup: group
|
buttonGroup: group
|
||||||
|
|
||||||
enabled: !root.disableAdminPermission
|
enabled: root.enableAdminPermission
|
||||||
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
}
|
}
|
||||||
@ -160,7 +160,7 @@ StatusDropdown {
|
|||||||
readonly property string description:
|
readonly property string description:
|
||||||
qsTr("Members who meet the requirements will be allowed to read the selected channels")
|
qsTr("Members who meet the requirements will be allowed to read the selected channels")
|
||||||
|
|
||||||
title: qsTr("Read")
|
title: qsTr("View only")
|
||||||
asset.name: "show"
|
asset.name: "show"
|
||||||
checked: d.initialPermissionType === permissionType
|
checked: d.initialPermissionType === permissionType
|
||||||
buttonGroup: group
|
buttonGroup: group
|
||||||
|
@ -81,6 +81,18 @@ StatusScrollView {
|
|||||||
permissionType === PermissionTypes.Type.Admin ||
|
permissionType === PermissionTypes.Type.Admin ||
|
||||||
permissionType === PermissionTypes.Type.Member
|
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: {
|
onIsCommunityPermissionChanged: {
|
||||||
if (isCommunityPermission) {
|
if (isCommunityPermission) {
|
||||||
inModelChannels.clear()
|
inModelChannels.clear()
|
||||||
@ -431,7 +443,7 @@ StatusScrollView {
|
|||||||
id: permissionsDropdown
|
id: permissionsDropdown
|
||||||
|
|
||||||
initialPermissionType: d.permissionType
|
initialPermissionType: d.permissionType
|
||||||
disableAdminPermission: !root.store.isOwner
|
enableAdminPermission: root.store.isOwner
|
||||||
|
|
||||||
onDone: {
|
onDone: {
|
||||||
if (d.permissionType === permissionType) {
|
if (d.permissionType === permissionType) {
|
||||||
@ -594,14 +606,14 @@ StatusScrollView {
|
|||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
StatusBaseText {
|
StatusBaseText {
|
||||||
text: qsTr("Private")
|
text: qsTr("Hide permission")
|
||||||
color: Theme.palette.directColor1
|
color: Theme.palette.directColor1
|
||||||
font.pixelSize: 15
|
font.pixelSize: 15
|
||||||
}
|
}
|
||||||
StatusBaseText {
|
StatusBaseText {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.fillHeight: 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
|
color: Theme.palette.baseColor1
|
||||||
font.pixelSize: 15
|
font.pixelSize: 15
|
||||||
lineHeight: 1.2
|
lineHeight: 1.2
|
||||||
@ -611,6 +623,7 @@ StatusScrollView {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
StatusSwitch {
|
StatusSwitch {
|
||||||
|
enabled: d.permissionType !== PermissionTypes.Type.Admin
|
||||||
checked: d.dirtyValues.isPrivateDirty ? !root.isPrivate : root.isPrivate
|
checked: d.dirtyValues.isPrivateDirty ? !root.isPrivate : root.isPrivate
|
||||||
onToggled: d.dirtyValues.isPrivateDirty = (root.isPrivate !== checked)
|
onToggled: d.dirtyValues.isPrivateDirty = (root.isPrivate !== checked)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user