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_VISIBILITY = 2 #windowed visibility, from qml
|
||||
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
|
||||
const LAS_KEY_SHARDED_COMMUNITIES_ENABLED = "global/sharded_communities"
|
||||
const DEFAULT_LAS_KEY_SHARDED_COMMUNITIES_ENABLED = false
|
||||
const LAS_KEY_TRANSLATIONS_ENABLED = "global/translations_enabled"
|
||||
const DEFAULT_LAS_KEY_TRANSLATIONS_ENABLED = false
|
||||
const DEFAULT_LAS_KEY_CREATE_COMMUNITIES_ENABLED = false
|
||||
|
||||
QtObject:
|
||||
type LocalAppSettings* = ref object of QObject
|
||||
|
@ -148,6 +150,19 @@ QtObject:
|
|||
write = setFakeLoadingScreenEnabled
|
||||
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 getWakuV2ShardedCommunitiesEnabled*(self: LocalAppSettings): bool {.slot.} =
|
||||
self.settings.value(LAS_KEY_SHARDED_COMMUNITIES_ENABLED, newQVariant(DEFAULT_LAS_KEY_SHARDED_COMMUNITIES_ENABLED)).boolVal
|
||||
|
|
|
@ -137,10 +137,13 @@ StatusSectionLayout {
|
|||
onClicked: Global.importCommunityPopupRequested()
|
||||
}
|
||||
|
||||
StatusButton {
|
||||
Loader {
|
||||
Layout.preferredHeight: active ? 38 : 0
|
||||
active: communitiesStore.createCommunityEnabled || communitiesStore.testEnvironment
|
||||
sourceComponent: StatusButton {
|
||||
id: createBtn
|
||||
objectName: "createCommunityButton"
|
||||
Layout.preferredHeight: 38
|
||||
height: parent.height
|
||||
verticalPadding: 0
|
||||
text: qsTr("Create community")
|
||||
onClicked: {
|
||||
|
@ -148,6 +151,7 @@ StatusSectionLayout {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TagsRow {
|
||||
id: communityTags
|
||||
|
|
|
@ -35,6 +35,9 @@ QtObject {
|
|||
property bool downloadingCommunityHistoryArchives: root.communitiesModuleInst.downloadingCommunityHistoryArchives
|
||||
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??
|
||||
//property var featuredCommunitiesModel: root.communitiesModuleInst.curatedFeaturedCommunities
|
||||
//property var popularCommunitiesModel: root.communitiesModuleInst.curatedPopularCommunities
|
||||
|
|
|
@ -22,6 +22,7 @@ QtObject {
|
|||
property var customNetworksModel: advancedModule? advancedModule.customNetworksModel : []
|
||||
|
||||
readonly property bool isFakeLoadingScreenEnabled: localAppSettings.fakeLoadingScreenEnabled ?? false
|
||||
readonly property bool createCommunityEnabled: localAppSettings.createCommunityEnabled ?? false
|
||||
property bool isManageCommunityOnTestModeEnabled: false
|
||||
readonly property QtObject experimentalFeatures: QtObject {
|
||||
readonly property string browser: "browser"
|
||||
|
@ -142,6 +143,13 @@ QtObject {
|
|||
localAppSettings.fakeLoadingScreenEnabled = !localAppSettings.fakeLoadingScreenEnabled
|
||||
}
|
||||
|
||||
function toggleCreateCommunityEnabled() {
|
||||
if(!localAppSettings)
|
||||
return
|
||||
|
||||
localAppSettings.createCommunityEnabled = !localAppSettings.createCommunityEnabled
|
||||
}
|
||||
|
||||
function toggleManageCommunityOnTestnet() {
|
||||
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 {
|
||||
anchors.leftMargin: 0
|
||||
anchors.rightMargin: 0
|
||||
|
|
Loading…
Reference in New Issue