mirror of
https://github.com/status-im/status-desktop.git
synced 2025-02-04 10:44:23 +00:00
d813cc12b8
So far CP components (views, panels) were accessing stores directly. Now `CommunitySettingsView` is a single place where stores are accessed. Other components no longer depend on stores. Moreover: - dedicated store `PermissionsStore` created for handling permissions in a single, separated place - storybook pages fixed Closes: #9784
51 lines
1.5 KiB
QML
51 lines
1.5 KiB
QML
import QtQml 2.15
|
|
|
|
QtObject {
|
|
id: root
|
|
|
|
required property string activeSectionId
|
|
required property var chatCommunitySectionModuleInst
|
|
|
|
readonly property var permissionsModel:
|
|
chatCommunitySectionModuleInst.permissionsModel
|
|
|
|
readonly property bool isOwner: false
|
|
|
|
readonly property QtObject _d: QtObject {
|
|
id: d
|
|
|
|
function createPermissionEntry(holdings, permissionType, isPrivate,
|
|
channels) {
|
|
return {
|
|
holdingsListModel: holdings,
|
|
channelsListModel: channels,
|
|
permissionType,
|
|
isPrivate
|
|
}
|
|
}
|
|
|
|
function createOrEdit(key, holdings, permissionType, isPrivate,
|
|
channels) {
|
|
|
|
root.chatCommunitySectionModuleInst.createOrEditCommunityTokenPermission(
|
|
root.activeSectionId, key,
|
|
permissionType,
|
|
JSON.stringify(holdings),
|
|
isPrivate)
|
|
}
|
|
}
|
|
|
|
function createPermission(holdings, permissionType, isPrivate, channels) {
|
|
d.createOrEdit("", holdings, permissionType, isPrivate, channels)
|
|
}
|
|
|
|
function editPermission(key, holdings, permissionType, channels, isPrivate) {
|
|
d.createOrEdit(key, holdings, permissionType, isPrivate, channels)
|
|
}
|
|
|
|
function removePermission(key) {
|
|
root.chatCommunitySectionModuleInst.deleteCommunityTokenPermission(
|
|
root.activeSectionId, key)
|
|
}
|
|
}
|