From c3f9b2dcc3081b25fe856e694a5626992c286d91 Mon Sep 17 00:00:00 2001 From: Satsuki Yanagi <17376330+u1-liquid@users.noreply.github.com> Date: Thu, 12 Sep 2019 21:27:44 +0900 Subject: [PATCH] Resolve #5420 (#5421) --- src/client/app/admin/views/federation.vue | 2 +- src/client/app/admin/views/instance.vue | 6 +++--- src/server/api/endpoints/admin/update-meta.ts | 10 +++++----- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/client/app/admin/views/federation.vue b/src/client/app/admin/views/federation.vue index 8b7719069..b419cca1d 100644 --- a/src/client/app/admin/views/federation.vue +++ b/src/client/app/admin/views/federation.vue @@ -509,7 +509,7 @@ export default Vue.extend({ saveBlockedHosts() { this.$root.api('admin/update-meta', { - blockedHosts: this.blockedHosts.split('\n') + blockedHosts: this.blockedHosts ? this.blockedHosts.split('\n') : [] }).then(() => { this.$root.dialog({ type: 'success', diff --git a/src/client/app/admin/views/instance.vue b/src/client/app/admin/views/instance.vue index 2d0fc9b40..223b3531e 100644 --- a/src/client/app/admin/views/instance.vue +++ b/src/client/app/admin/views/instance.vue @@ -461,7 +461,7 @@ export default Vue.extend({ iconUrl: this.iconUrl, name: this.name, description: this.description, - langs: this.languages.split(' '), + langs: this.languages ? this.languages.split(' ') : [], cacheRemoteFiles: this.cacheRemoteFiles, localDriveCapacityMb: parseInt(this.localDriveCapacityMb, 10), remoteDriveCapacityMb: parseInt(this.remoteDriveCapacityMb, 10), @@ -490,8 +490,8 @@ export default Vue.extend({ enableServiceWorker: this.enableServiceWorker, swPublicKey: this.swPublicKey, swPrivateKey: this.swPrivateKey, - pinnedUsers: this.pinnedUsers.split('\n'), - hiddenTags: this.hiddenTags.split('\n'), + pinnedUsers: this.pinnedUsers ? this.pinnedUsers.split('\n') : [], + hiddenTags: this.hiddenTags ? this.hiddenTags.split('\n') : [], useObjectStorage: this.useObjectStorage, objectStorageBaseUrl: this.objectStorageBaseUrl ? this.objectStorageBaseUrl : null, objectStorageBucket: this.objectStorageBucket ? this.objectStorageBucket : null, diff --git a/src/server/api/endpoints/admin/update-meta.ts b/src/server/api/endpoints/admin/update-meta.ts index 834faa42b..1d6973e7a 100644 --- a/src/server/api/endpoints/admin/update-meta.ts +++ b/src/server/api/endpoints/admin/update-meta.ts @@ -430,15 +430,15 @@ export default define(meta, async (ps, me) => { } if (Array.isArray(ps.pinnedUsers)) { - set.pinnedUsers = ps.pinnedUsers; + set.pinnedUsers = ps.pinnedUsers.filter(Boolean); } if (Array.isArray(ps.hiddenTags)) { - set.hiddenTags = ps.hiddenTags; + set.hiddenTags = ps.hiddenTags.filter(Boolean); } if (Array.isArray(ps.blockedHosts)) { - set.blockedHosts = ps.blockedHosts; + set.blockedHosts = ps.blockedHosts.filter(Boolean); } if (ps.mascotImageUrl !== undefined) { @@ -501,8 +501,8 @@ export default define(meta, async (ps, me) => { set.maintainerEmail = ps.maintainerEmail; } - if (ps.langs !== undefined) { - set.langs = ps.langs; + if (Array.isArray(ps.langs)) { + set.langs = ps.langs.filter(Boolean); } if (ps.summalyProxy !== undefined) {