aboutsummaryrefslogtreecommitdiff
path: root/src/components
diff options
context:
space:
mode:
Diffstat (limited to 'src/components')
-rw-r--r--src/components/settings_modal/admin_tabs/instance_tab.js4
-rw-r--r--src/components/settings_modal/admin_tabs/instance_tab.vue15
-rw-r--r--src/components/settings_modal/helpers/group_setting.js14
-rw-r--r--src/components/settings_modal/helpers/group_setting.vue15
-rw-r--r--src/components/settings_modal/helpers/setting.js32
5 files changed, 75 insertions, 5 deletions
diff --git a/src/components/settings_modal/admin_tabs/instance_tab.js b/src/components/settings_modal/admin_tabs/instance_tab.js
index 7aaedbce..f702afcf 100644
--- a/src/components/settings_modal/admin_tabs/instance_tab.js
+++ b/src/components/settings_modal/admin_tabs/instance_tab.js
@@ -2,6 +2,7 @@ import BooleanSetting from '../helpers/boolean_setting.vue'
import ChoiceSetting from '../helpers/choice_setting.vue'
import IntegerSetting from '../helpers/integer_setting.vue'
import StringSetting from '../helpers/string_setting.vue'
+import GroupSetting from '../helpers/group_setting.vue'
import SharedComputedObject from '../helpers/shared_computed_object.js'
import { library } from '@fortawesome/fontawesome-svg-core'
@@ -24,7 +25,8 @@ const InstanceTab = {
BooleanSetting,
ChoiceSetting,
IntegerSetting,
- StringSetting
+ StringSetting,
+ GroupSetting
},
computed: {
...SharedComputedObject()
diff --git a/src/components/settings_modal/admin_tabs/instance_tab.vue b/src/components/settings_modal/admin_tabs/instance_tab.vue
index 96d8a17e..9291ddf8 100644
--- a/src/components/settings_modal/admin_tabs/instance_tab.vue
+++ b/src/components/settings_modal/admin_tabs/instance_tab.vue
@@ -71,6 +71,11 @@
</BooleanSetting>
</li>
<li>
+ <GroupSetting path=":pleroma.:restrict_unauthenticated.:timelines">
+ TIMELINES
+ </GroupSetting>
+ </li>
+ <li>
<h4>{{ $t('admin_dash.instance.restrict.profiles') }}</h4>
</li>
<li>
@@ -90,6 +95,11 @@
</BooleanSetting>
</li>
<li>
+ <GroupSetting path=":pleroma.:restrict_unauthenticated.:profiles">
+ PROFILES
+ </GroupSetting>
+ </li>
+ <li>
<h4>{{ $t('admin_dash.instance.restrict.activities') }}</h4>
</li>
<li>
@@ -108,6 +118,11 @@
FED STATUSES
</BooleanSetting>
</li>
+ <li>
+ <GroupSetting path=":pleroma.:restrict_unauthenticated.:activities">
+ STATUSES
+ </GroupSetting>
+ </li>
</ul>
</div>
<div class="setting-item">
diff --git a/src/components/settings_modal/helpers/group_setting.js b/src/components/settings_modal/helpers/group_setting.js
new file mode 100644
index 00000000..12a49000
--- /dev/null
+++ b/src/components/settings_modal/helpers/group_setting.js
@@ -0,0 +1,14 @@
+import { isEqual } from 'lodash'
+
+import Setting from './setting.js'
+
+export default {
+ ...Setting,
+ computed: {
+ ...Setting.computed,
+ isDirty () {
+ console.log(this.state, this.draft)
+ return !isEqual(this.state, this.draft)
+ }
+ }
+}
diff --git a/src/components/settings_modal/helpers/group_setting.vue b/src/components/settings_modal/helpers/group_setting.vue
new file mode 100644
index 00000000..a4df4bf3
--- /dev/null
+++ b/src/components/settings_modal/helpers/group_setting.vue
@@ -0,0 +1,15 @@
+<template>
+ <span
+ v-if="matchesExpertLevel"
+ class="GroupSetting"
+ >
+ <ModifiedIndicator
+ :changed="isChanged"
+ :onclick="reset"
+ />
+ <ProfileSettingIndicator :is-profile="isProfileSetting" />
+ <DraftButtons />
+ </span>
+</template>
+
+<script src="./group_setting.js"></script>
diff --git a/src/components/settings_modal/helpers/setting.js b/src/components/settings_modal/helpers/setting.js
index d42ae763..d2e1a6f4 100644
--- a/src/components/settings_modal/helpers/setting.js
+++ b/src/components/settings_modal/helpers/setting.js
@@ -48,15 +48,32 @@ export default {
},
data () {
return {
- draft: null
+ localDraft: null
}
},
created () {
- if (this.realDraftMode) {
+ if (this.realDraftMode && this.realSource !== 'admin') {
this.draft = this.state
}
},
computed: {
+ draft: {
+ // TODO allow passing shared draft object?
+ get () {
+ if (this.realSource === 'admin') {
+ return get(this.$store.state.adminSettings.draft, this.path)
+ } else {
+ return this.localDraft
+ }
+ },
+ set (value) {
+ if (this.realSource === 'admin') {
+ this.$store.commit('updateAdminDraft', { path: this.canonPath, value })
+ } else {
+ this.localDraft = value
+ }
+ }
+ },
state () {
const value = get(this.configSource, this.path)
if (value === undefined) {
@@ -130,11 +147,18 @@ export default {
return this.state !== this.defaultState
}
},
+ canonPath () {
+ return Array.isArray(this.path) ? this.path : this.path.split('.')
+ },
isDirty () {
- return this.realDraftMode && this.draft !== this.state
+ if (this.realSource === 'admin' && this.canonPath.length > 3) {
+ return false // should not show draft buttons for "grouped" values
+ } else {
+ return this.realDraftMode && this.draft !== this.state
+ }
},
canHardReset () {
- return this.realSource === 'admin' && this.$store.state.adminSettings.modifiedPaths.has(this.path)
+ return this.realSource === 'admin' && this.$store.state.adminSettings.modifiedPaths.has(this.canonPath.join(' -> '))
},
matchesExpertLevel () {
return (this.expert || 0) <= this.$store.state.config.expertLevel > 0