chore: hide create community button behind advanced setting
Fixes #14530 (includes a revert of the previous hide that wasn't exactly what we wanted)
This commit is contained in:
parent
e17782102b
commit
e463590a40
|
@ -17,11 +17,13 @@ const LAS_KEY_CUSTOM_MOUSE_SCROLLING_ENABLED = "global/custom_mouse_scroll_enabl
|
||||||
const DEFAULT_CUSTOM_MOUSE_SCROLLING_ENABLED = false
|
const DEFAULT_CUSTOM_MOUSE_SCROLLING_ENABLED = false
|
||||||
const DEFAULT_VISIBILITY = 2 #windowed visibility, from qml
|
const DEFAULT_VISIBILITY = 2 #windowed visibility, from qml
|
||||||
const LAS_KEY_FAKE_LOADING_SCREEN_ENABLED = "global/fake_loading_screen"
|
const LAS_KEY_FAKE_LOADING_SCREEN_ENABLED = "global/fake_loading_screen"
|
||||||
|
const LAS_KEY_CREATE_COMMUNITIES_ENABLED = "global/create_communities"
|
||||||
let DEFAULT_FAKE_LOADING_SCREEN_ENABLED = defined(production) and not TEST_MODE_ENABLED #enabled in production, disabled in development and e2e tests
|
let DEFAULT_FAKE_LOADING_SCREEN_ENABLED = defined(production) and not TEST_MODE_ENABLED #enabled in production, disabled in development and e2e tests
|
||||||
const LAS_KEY_SHARDED_COMMUNITIES_ENABLED = "global/sharded_communities"
|
const LAS_KEY_SHARDED_COMMUNITIES_ENABLED = "global/sharded_communities"
|
||||||
const DEFAULT_LAS_KEY_SHARDED_COMMUNITIES_ENABLED = false
|
const DEFAULT_LAS_KEY_SHARDED_COMMUNITIES_ENABLED = false
|
||||||
const LAS_KEY_TRANSLATIONS_ENABLED = "global/translations_enabled"
|
const LAS_KEY_TRANSLATIONS_ENABLED = "global/translations_enabled"
|
||||||
const DEFAULT_LAS_KEY_TRANSLATIONS_ENABLED = false
|
const DEFAULT_LAS_KEY_TRANSLATIONS_ENABLED = false
|
||||||
|
const DEFAULT_LAS_KEY_CREATE_COMMUNITIES_ENABLED = false
|
||||||
|
|
||||||
QtObject:
|
QtObject:
|
||||||
type LocalAppSettings* = ref object of QObject
|
type LocalAppSettings* = ref object of QObject
|
||||||
|
@ -148,6 +150,19 @@ QtObject:
|
||||||
write = setFakeLoadingScreenEnabled
|
write = setFakeLoadingScreenEnabled
|
||||||
notify = fakeLoadingScreenEnabledChanged
|
notify = fakeLoadingScreenEnabledChanged
|
||||||
|
|
||||||
|
proc createCommunityEnabledChanged*(self: LocalAppSettings) {.signal.}
|
||||||
|
proc getCreateCommunityEnabled*(self: LocalAppSettings): bool {.slot.} =
|
||||||
|
self.settings.value(LAS_KEY_CREATE_COMMUNITIES_ENABLED, newQVariant(DEFAULT_LAS_KEY_CREATE_COMMUNITIES_ENABLED)).boolVal
|
||||||
|
|
||||||
|
proc setCreateCommunityEnabled*(self: LocalAppSettings, enabled: bool) {.slot.} =
|
||||||
|
self.settings.setValue(LAS_KEY_CREATE_COMMUNITIES_ENABLED, newQVariant(enabled))
|
||||||
|
self.createCommunityEnabledChanged()
|
||||||
|
|
||||||
|
QtProperty[bool] createCommunityEnabled:
|
||||||
|
read = getCreateCommunityEnabled
|
||||||
|
write = setCreateCommunityEnabled
|
||||||
|
notify = createCommunityEnabledChanged
|
||||||
|
|
||||||
proc wakuV2ShardedCommunitiesEnabledChanged*(self: LocalAppSettings) {.signal.}
|
proc wakuV2ShardedCommunitiesEnabledChanged*(self: LocalAppSettings) {.signal.}
|
||||||
proc getWakuV2ShardedCommunitiesEnabled*(self: LocalAppSettings): bool {.slot.} =
|
proc getWakuV2ShardedCommunitiesEnabled*(self: LocalAppSettings): bool {.slot.} =
|
||||||
self.settings.value(LAS_KEY_SHARDED_COMMUNITIES_ENABLED, newQVariant(DEFAULT_LAS_KEY_SHARDED_COMMUNITIES_ENABLED)).boolVal
|
self.settings.value(LAS_KEY_SHARDED_COMMUNITIES_ENABLED, newQVariant(DEFAULT_LAS_KEY_SHARDED_COMMUNITIES_ENABLED)).boolVal
|
||||||
|
|
|
@ -137,14 +137,18 @@ StatusSectionLayout {
|
||||||
onClicked: Global.importCommunityPopupRequested()
|
onClicked: Global.importCommunityPopupRequested()
|
||||||
}
|
}
|
||||||
|
|
||||||
StatusButton {
|
Loader {
|
||||||
id: createBtn
|
Layout.preferredHeight: active ? 38 : 0
|
||||||
objectName: "createCommunityButton"
|
active: communitiesStore.createCommunityEnabled || communitiesStore.testEnvironment
|
||||||
Layout.preferredHeight: 38
|
sourceComponent: StatusButton {
|
||||||
verticalPadding: 0
|
id: createBtn
|
||||||
text: qsTr("Create community")
|
objectName: "createCommunityButton"
|
||||||
onClicked: {
|
height: parent.height
|
||||||
Global.openPopup(chooseCommunityCreationTypePopupComponent)
|
verticalPadding: 0
|
||||||
|
text: qsTr("Create community")
|
||||||
|
onClicked: {
|
||||||
|
Global.openPopup(chooseCommunityCreationTypePopupComponent)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,6 +35,9 @@ QtObject {
|
||||||
property bool downloadingCommunityHistoryArchives: root.communitiesModuleInst.downloadingCommunityHistoryArchives
|
property bool downloadingCommunityHistoryArchives: root.communitiesModuleInst.downloadingCommunityHistoryArchives
|
||||||
property var advancedModule: profileSectionModule.advancedModule
|
property var advancedModule: profileSectionModule.advancedModule
|
||||||
|
|
||||||
|
readonly property bool createCommunityEnabled: localAppSettings.createCommunityEnabled ?? false
|
||||||
|
readonly property bool testEnvironment: localAppSettings.testEnvironment ?? false
|
||||||
|
|
||||||
// TODO: Could the backend provide directly 2 filtered models??
|
// TODO: Could the backend provide directly 2 filtered models??
|
||||||
//property var featuredCommunitiesModel: root.communitiesModuleInst.curatedFeaturedCommunities
|
//property var featuredCommunitiesModel: root.communitiesModuleInst.curatedFeaturedCommunities
|
||||||
//property var popularCommunitiesModel: root.communitiesModuleInst.curatedPopularCommunities
|
//property var popularCommunitiesModel: root.communitiesModuleInst.curatedPopularCommunities
|
||||||
|
|
|
@ -22,6 +22,7 @@ QtObject {
|
||||||
property var customNetworksModel: advancedModule? advancedModule.customNetworksModel : []
|
property var customNetworksModel: advancedModule? advancedModule.customNetworksModel : []
|
||||||
|
|
||||||
readonly property bool isFakeLoadingScreenEnabled: localAppSettings.fakeLoadingScreenEnabled ?? false
|
readonly property bool isFakeLoadingScreenEnabled: localAppSettings.fakeLoadingScreenEnabled ?? false
|
||||||
|
readonly property bool createCommunityEnabled: localAppSettings.createCommunityEnabled ?? false
|
||||||
property bool isManageCommunityOnTestModeEnabled: false
|
property bool isManageCommunityOnTestModeEnabled: false
|
||||||
readonly property QtObject experimentalFeatures: QtObject {
|
readonly property QtObject experimentalFeatures: QtObject {
|
||||||
readonly property string browser: "browser"
|
readonly property string browser: "browser"
|
||||||
|
@ -142,6 +143,13 @@ QtObject {
|
||||||
localAppSettings.fakeLoadingScreenEnabled = !localAppSettings.fakeLoadingScreenEnabled
|
localAppSettings.fakeLoadingScreenEnabled = !localAppSettings.fakeLoadingScreenEnabled
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function toggleCreateCommunityEnabled() {
|
||||||
|
if(!localAppSettings)
|
||||||
|
return
|
||||||
|
|
||||||
|
localAppSettings.createCommunityEnabled = !localAppSettings.createCommunityEnabled
|
||||||
|
}
|
||||||
|
|
||||||
function toggleManageCommunityOnTestnet() {
|
function toggleManageCommunityOnTestnet() {
|
||||||
root.isManageCommunityOnTestModeEnabled = !root.isManageCommunityOnTestModeEnabled
|
root.isManageCommunityOnTestModeEnabled = !root.isManageCommunityOnTestModeEnabled
|
||||||
}
|
}
|
||||||
|
|
|
@ -171,6 +171,17 @@ SettingsContentBase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
StatusSettingsLineButton {
|
||||||
|
anchors.leftMargin: 0
|
||||||
|
anchors.rightMargin: 0
|
||||||
|
text: qsTr("Enable Community Creation")
|
||||||
|
isSwitch: true
|
||||||
|
switchChecked: root.advancedStore.createCommunityEnabled
|
||||||
|
onClicked: {
|
||||||
|
root.advancedStore.toggleCreateCommunityEnabled()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
StatusSettingsLineButton {
|
StatusSettingsLineButton {
|
||||||
anchors.leftMargin: 0
|
anchors.leftMargin: 0
|
||||||
anchors.rightMargin: 0
|
anchors.rightMargin: 0
|
||||||
|
|
Loading…
Reference in New Issue