diff --git a/src/components/settings_modal/admin_tabs/instance_tab.vue b/src/components/settings_modal/admin_tabs/instance_tab.vue
index 18ba6127..ad271293 100644
--- a/src/components/settings_modal/admin_tabs/instance_tab.vue
+++ b/src/components/settings_modal/admin_tabs/instance_tab.vue
@@ -12,6 +12,15 @@
NAME
+
+
+ ADMIN EMAIL
+
+
-
- POST LIMIT
-
+ SHORT DESCRIPTION
+
+
+
+
+ INSTANCE THUMBNAIL
+
+
+
+
+ BACKGROUND IMAGE
+
+
+
+
+ PUBLIC
+
+
+
+
+
+
{{ $t('admin_dash.registrations') }}
+
+ -
+
+ REGISTRATIONS OPEN
+
+
+ -
+
+ INVITES ENABLED
+
+
+
+
+ -
+
+ ACTIVATION REQUIRED
+
+
+ -
+
+ APPROVAL REQUIRED
+
@@ -36,17 +117,3 @@
-
-
diff --git a/src/components/settings_modal/admin_tabs/limits_tab.js b/src/components/settings_modal/admin_tabs/limits_tab.js
new file mode 100644
index 00000000..684739c3
--- /dev/null
+++ b/src/components/settings_modal/admin_tabs/limits_tab.js
@@ -0,0 +1,29 @@
+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 SharedComputedObject from '../helpers/shared_computed_object.js'
+import { library } from '@fortawesome/fontawesome-svg-core'
+import {
+ faGlobe
+} from '@fortawesome/free-solid-svg-icons'
+
+library.add(
+ faGlobe
+)
+
+const LimitsTab = {
+ data () {},
+ components: {
+ BooleanSetting,
+ ChoiceSetting,
+ IntegerSetting,
+ StringSetting
+ },
+ computed: {
+ ...SharedComputedObject()
+ }
+}
+
+export default LimitsTab
diff --git a/src/components/settings_modal/admin_tabs/limits_tab.vue b/src/components/settings_modal/admin_tabs/limits_tab.vue
new file mode 100644
index 00000000..3f07c554
--- /dev/null
+++ b/src/components/settings_modal/admin_tabs/limits_tab.vue
@@ -0,0 +1,152 @@
+
+
+
+
{{ $t('admin_dash.arbitrary_limits') }}
+
+ -
+
{{ $t('admin_dash.limits.posts') }}
+
+ -
+
+ POST LIMIT
+
+
+ -
+
+ POST LIMIT (remote)
+
+
+ -
+
{{ $t('admin_dash.limits.uploads') }}
+
+ -
+
+ IMAGE DESCRIPTION LIMIT
+
+
+ -
+
+ UPLOAD LIMIT KiB
+
+
+ -
+
+ MAX ATTACHMENTS
+
+
+ -
+
{{ $t('admin_dash.limits.users') }}
+
+ -
+
+ BIO LENGTH
+
+
+ -
+
+ NAME LENGTH
+
+
+ -
+
{{ $t('admin_dash.limits.profile_fields') }}
+
+ -
+
+ MAX ACCOUNT FIELDS
+
+
+ -
+
+ MAX ACCOUNT FIELDS (remote)
+
+
+ -
+
+ MAX ACCOUNT FIELD NAME
+
+
+ -
+
+ MAX ACCOUNT VALUE NAME
+
+
+ -
+
{{ $t('admin_dash.limits.user_uploads') }}
+
+ -
+
+ MAX AVATAR SIZE KiB
+
+
+ -
+
+ MAX BANNER SIZE KiB
+
+
+ -
+
+ MAX PINNED POSTS
+
+
+
+
+
+
+
+
diff --git a/src/components/settings_modal/helpers/boolean_setting.vue b/src/components/settings_modal/helpers/boolean_setting.vue
index 7e05fe85..aedbf23e 100644
--- a/src/components/settings_modal/helpers/boolean_setting.vue
+++ b/src/components/settings_modal/helpers/boolean_setting.vue
@@ -12,7 +12,12 @@
v-if="!!$slots.default"
class="label"
>
-
+
+ {{ backendDescriptionLabel + ' ' }}
+
+
+
+
{{ ' ' }}
+
+ {{ backendDescriptionDescription + ' ' }}
+
diff --git a/src/components/settings_modal/helpers/integer_setting.vue b/src/components/settings_modal/helpers/integer_setting.vue
index e900b87c..e935dfb0 100644
--- a/src/components/settings_modal/helpers/integer_setting.vue
+++ b/src/components/settings_modal/helpers/integer_setting.vue
@@ -4,7 +4,12 @@
class="IntegerSetting"
>
+
+ {{ backendDescriptionDescription + ' ' }}
+
diff --git a/src/components/settings_modal/helpers/setting.js b/src/components/settings_modal/helpers/setting.js
index 0971b919..f270216f 100644
--- a/src/components/settings_modal/helpers/setting.js
+++ b/src/components/settings_modal/helpers/setting.js
@@ -59,6 +59,16 @@ export default {
return value
}
},
+ backendDescription () {
+ console.log(get(this.$store.state.adminSettings.descriptions, this.path))
+ return get(this.$store.state.adminSettings.descriptions, this.path)
+ },
+ backendDescriptionLabel () {
+ return this.backendDescription.label
+ },
+ backendDescriptionDescription () {
+ return this.backendDescription.description
+ },
shouldBeDisabled () {
const parentValue = this.parentPath !== undefined ? get(this.configSource, this.parentPath) : null
return this.disabled || (parentValue !== null ? (this.parentInvert ? parentValue : !parentValue) : false)
diff --git a/src/components/settings_modal/helpers/string_setting.vue b/src/components/settings_modal/helpers/string_setting.vue
index 0a71aeab..91a4afa4 100644
--- a/src/components/settings_modal/helpers/string_setting.vue
+++ b/src/components/settings_modal/helpers/string_setting.vue
@@ -4,7 +4,12 @@
class="StringSetting"
>
+
+ {{ backendDescriptionDescription + ' ' }}
+
diff --git a/src/components/settings_modal/settings_modal.scss b/src/components/settings_modal/settings_modal.scss
index f5861229..4cce6099 100644
--- a/src/components/settings_modal/settings_modal.scss
+++ b/src/components/settings_modal/settings_modal.scss
@@ -17,6 +17,12 @@
}
}
+ .setting-description {
+ margin-top: 0.2em;
+ margin-bottom: 2em;
+ font-size: 70%;
+ }
+
.settings-modal-panel {
overflow: hidden;
transition: transform;
diff --git a/src/components/settings_modal/settings_modal_admin_content.js b/src/components/settings_modal/settings_modal_admin_content.js
index 88ba1755..c6c8837f 100644
--- a/src/components/settings_modal/settings_modal_admin_content.js
+++ b/src/components/settings_modal/settings_modal_admin_content.js
@@ -3,6 +3,7 @@ import TabSwitcher from 'src/components/tab_switcher/tab_switcher.jsx'
import DataImportExportTab from './tabs/data_import_export_tab.vue'
import MutesAndBlocksTab from './tabs/mutes_and_blocks_tab.vue'
import InstanceTab from './admin_tabs/instance_tab.vue'
+import LimitsTab from './admin_tabs/limits_tab.vue'
import { library } from '@fortawesome/fontawesome-svg-core'
import {
@@ -33,7 +34,8 @@ const SettingsModalAdminContent = {
DataImportExportTab,
MutesAndBlocksTab,
- InstanceTab
+ InstanceTab,
+ LimitsTab
},
computed: {
isLoggedIn () {
diff --git a/src/components/settings_modal/settings_modal_admin_content.vue b/src/components/settings_modal/settings_modal_admin_content.vue
index 9873b127..16b55828 100644
--- a/src/components/settings_modal/settings_modal_admin_content.vue
+++ b/src/components/settings_modal/settings_modal_admin_content.vue
@@ -7,12 +7,19 @@
:body-scroll-lock="bodyLock"
>
+
+
+
diff --git a/src/modules/adminSettings.js b/src/modules/adminSettings.js
index d1df67d4..44a4d409 100644
--- a/src/modules/adminSettings.js
+++ b/src/modules/adminSettings.js
@@ -3,7 +3,8 @@ import { set, cloneDeep } from 'lodash'
export const defaultState = {
needsReboot: null,
config: null,
- modifiedPaths: null
+ modifiedPaths: null,
+ descriptions: null
}
export const newUserFlags = {
@@ -18,6 +19,9 @@ const adminSettingsStorage = {
updateAdminSettings (state, { config, modifiedPaths }) {
state.config = config
state.modifiedPaths = modifiedPaths
+ },
+ updateAdminDescriptions (state, { descriptions }) {
+ state.descriptions = descriptions
}
},
actions: {
@@ -40,8 +44,25 @@ const adminSettingsStorage = {
}
set(config, path, convert(c.value))
})
+ console.log(config[':pleroma'][':welcome'])
commit('updateAdminSettings', { config, modifiedPaths })
},
+ setInstanceAdminDescriptions ({ state, commit, dispatch }, { backendDescriptions }) {
+ const convert = ({ children, description, label, key = '', group, suggestions }, path, acc) => {
+ const newPath = group ? group + '.' + key : key
+ const obj = { description, label, suggestions }
+ if (Array.isArray(children)) {
+ children.forEach(c => {
+ convert(c, '.' + newPath, obj)
+ })
+ }
+ set(acc, newPath, obj)
+ }
+
+ const descriptions = {}
+ backendDescriptions.forEach(d => convert(d, '', descriptions))
+ commit('updateAdminDescriptions', { descriptions })
+ },
pushAdminSetting ({ rootState, state, commit, dispatch }, { path, value }) {
const [group, key, ...rest] = path.split(/\./g)
const clone = {} // not actually cloning the entire thing to avoid excessive writes
@@ -71,7 +92,6 @@ const adminSettingsStorage = {
.then(backendDbConfig => dispatch('setInstanceAdminSettings', { backendDbConfig }))
},
resetAdminSetting ({ rootState, state, commit, dispatch }, { path }) {
- console.log('ASS')
const [group, key, subkey] = path.split(/\./g)
state.modifiedPaths.delete(path)
diff --git a/src/modules/users.js b/src/modules/users.js
index 12e582f4..45cba334 100644
--- a/src/modules/users.js
+++ b/src/modules/users.js
@@ -567,6 +567,8 @@ const users = {
if (user.rights.admin) {
store.rootState.api.backendInteractor.fetchInstanceDBConfig()
.then(backendDbConfig => dispatch('setInstanceAdminSettings', { backendDbConfig }))
+ store.rootState.api.backendInteractor.fetchInstanceConfigDescriptions()
+ .then(backendDescriptions => dispatch('setInstanceAdminDescriptions', { backendDescriptions }))
}
commit('addNewUsers', [user])
diff --git a/src/services/api/api.service.js b/src/services/api/api.service.js
index 71ba1dec..073f40a3 100644
--- a/src/services/api/api.service.js
+++ b/src/services/api/api.service.js
@@ -109,6 +109,7 @@ const PLEROMA_EDIT_ANNOUNCEMENT_URL = id => `/api/v1/pleroma/admin/announcements
const PLEROMA_DELETE_ANNOUNCEMENT_URL = id => `/api/v1/pleroma/admin/announcements/${id}`
const PLEROMA_ADMIN_CONFIG_URL = '/api/pleroma/admin/config'
+const PLEROMA_ADMIN_DESCRIPTIONS_URL = '/api/pleroma/admin/config/descriptions'
const oldfetch = window.fetch
@@ -1677,6 +1678,21 @@ const fetchInstanceDBConfig = ({ credentials }) => {
})
}
+const fetchInstanceConfigDescriptions = ({ credentials }) => {
+ return fetch(PLEROMA_ADMIN_DESCRIPTIONS_URL, {
+ headers: authHeaders(credentials)
+ })
+ .then((response) => {
+ if (response.ok) {
+ return response.json()
+ } else {
+ return {
+ error: response
+ }
+ }
+ })
+}
+
const pushInstanceDBConfig = ({ credentials, payload }) => {
return fetch(PLEROMA_ADMIN_CONFIG_URL, {
headers: {
@@ -1813,6 +1829,7 @@ const apiService = {
deleteAnnouncement,
adminFetchAnnouncements,
fetchInstanceDBConfig,
+ fetchInstanceConfigDescriptions,
pushInstanceDBConfig
}