diff --git a/CHANGELOG.md b/CHANGELOG.md index ddc93fd4948bb39aaa25a904be79825524c4ee98..9defc1e3efafebe91e45c818fddfc141747a4af6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### Fixed - Crash when parsing tuples in Settings +- Broken parsing of Settings ## [2.4.0] - 2021-08-01 diff --git a/package.json b/package.json index 961e61f9e61bf184ea5d123bde7c5ecdf84aec83..eb4a0bc77ee51e01b47fced8e05829e92bd168b6 100644 --- a/package.json +++ b/package.json @@ -29,13 +29,13 @@ ], "repository": { "type": "git", - "url": "git+https://github.com/PanJiaChen/vue-element-admin.git" + "url": "git+https://git.pleroma.social/pleroma/admin-fe.git" }, "resolutions": { "prosemirror-model": "1.9.1" }, "bugs": { - "url": "https://github.com/PanJiaChen/vue-element-admin/issues" + "url": "https://git.pleroma.social/pleroma/admin-fe/-/issues" }, "dependencies": { "@babel/runtime": "7.18.9", diff --git a/src/store/modules/normalizers.js b/src/store/modules/normalizers.js index e93ed1a5dcee425a502aaddd7f49af98a258f17c..dbea1447ccc167bcd1fcd1ae2536dde0d0586596 100644 --- a/src/store/modules/normalizers.js +++ b/src/store/modules/normalizers.js @@ -28,7 +28,7 @@ const getCurrentValue = (type, value, path) => { } const getValueWithoutKey = (key, [type, value]) => { - if (prependWithСolon(type, value)) { + if (prependWithColon(type, value)) { return `:${value}` } else if (key === ':backends') { const index = value.findIndex(el => el === ':ex_syslogger') @@ -117,8 +117,8 @@ export const parseTuples = (tuples, key) => { accum[item.tuple[0]] = parseNonTuples(item.tuple[0], item.tuple[1]) } else if (item.tuple[0] === ':ip_whitelist') { accum[item.tuple[0]] = item.tuple[1].map(ip => typeof ip === 'string' ? ip : ip.tuple.join('.')) - } else if (Array.isArray(item.tuple[1]) && - (typeof item.tuple[1][0] === 'object' && !Array.isArray(item.tuple[1][0])) && item.tuple[1][0]['tuple']) { + } else if (Array.isArray(item.tuple[1]) && (item.tuple[1][0] !== null && + typeof item.tuple[1][0] === 'object' && !Array.isArray(item.tuple[1][0])) && item.tuple[1][0]['tuple']) { accum[item.tuple[0]] = parseTuples(item.tuple[1], item.tuple[0]) } else if (Array.isArray(item.tuple[1])) { accum[item.tuple[0]] = item.tuple[1] @@ -171,7 +171,7 @@ const parseStringOrTupleValue = (key, value) => { } } -const prependWithСolon = (type, value) => { +const prependWithColon = (type, value) => { return (type === 'atom' && value.length > 0) || (Array.isArray(type) && type.includes('boolean') && type.includes('atom') && typeof value === 'string') } @@ -260,7 +260,7 @@ const wrapValues = (settings, currentState) => { )) ) { return { 'tuple': [setting, wrapValues(value, currentState)] } - } else if (prependWithСolon(type, value)) { + } else if (prependWithColon(type, value)) { return { 'tuple': [setting, `:${value}`] } } else if (type.includes('tuple') && (type.includes('string') || type.includes('atom') || type.includes('boolean'))) { diff --git a/src/views/layout/components/Sidebar/index.vue b/src/views/layout/components/Sidebar/index.vue index f57ebf1711135d04aec368bca4634f062c50fef0..ed8bd849640e0898a12d0e2ab2b682a128a87ab7 100644 --- a/src/views/layout/components/Sidebar/index.vue +++ b/src/views/layout/components/Sidebar/index.vue @@ -55,7 +55,12 @@ export default { }, async handleOpen($event) { if ($event === '/settings') { - if (!localStorage.getItem('settingsTabs')) { + let settingsTabs = localStorage.getItem('settingsTabs') + if (settingsTabs === '[]') { + localStorage.removeItem('settingsTabs') + settingsTabs = null + } + if (!settingsTabs) { await this.$store.dispatch('FetchSettings') const menuItems = this.tabs localStorage.setItem('settingsTabs', JSON.stringify(menuItems))