From 09f219c2017eefdc0ace322d677146ce4144e7f6 Mon Sep 17 00:00:00 2001 From: Angelina Filippova Date: Fri, 24 Apr 2020 17:20:56 +0300 Subject: [PATCH] Extract Rewrite Policy Input into separate component --- src/views/settings/components/Inputs.vue | 52 ++++--------- .../inputComponents/RewritePolicyInput.vue | 78 +++++++++++++++++++ .../components/inputComponents/index.js | 1 + 3 files changed, 95 insertions(+), 36 deletions(-) create mode 100644 src/views/settings/components/inputComponents/RewritePolicyInput.vue diff --git a/src/views/settings/components/Inputs.vue b/src/views/settings/components/Inputs.vue index 03da047f..e84e5a6f 100644 --- a/src/views/settings/components/Inputs.vue +++ b/src/views/settings/components/Inputs.vue @@ -66,29 +66,17 @@ :value="option" :key="index"/> -
- - - - - - -
+ + + + @@ -141,7 +130,8 @@ import { ProxyUrlInput, PruneInput, RateLimitInput, - RegInvitesInput } from './inputComponents' + RegInvitesInput, + RewritePolicyInput } from './inputComponents' import { processNested } from '@/store/modules/normalizers' import _ from 'lodash' import marked from 'marked' @@ -158,7 +148,8 @@ export default { ProxyUrlInput, PruneInput, RateLimitInput, - RegInvitesInput + RegInvitesInput, + RewritePolicyInput }, props: { customLabelWidth: { @@ -262,9 +253,6 @@ export default { keywordData() { return Array.isArray(this.data) ? this.data : [] }, - rewritePolicyValue() { - return typeof this.data[this.setting.key] === 'string' ? [this.data[this.setting.key]] : this.data[this.setting.key] - }, settings() { return this.$store.state.settings.settings }, @@ -315,14 +303,6 @@ export default { this.setting.key === ':args' ) }, - rewritePolicyOptions(suggestions) { - return suggestions.map(element => { - const label = element.split('Pleroma.Web.ActivityPub.MRF.')[1] - ? element.split('Pleroma.Web.ActivityPub.MRF.')[1] - : element - return { value: element, label } - }) - }, update(value, group, key, parents, input, type, nested) { nested ? this.processNestedData(value, group, key, parents) diff --git a/src/views/settings/components/inputComponents/RewritePolicyInput.vue b/src/views/settings/components/inputComponents/RewritePolicyInput.vue new file mode 100644 index 00000000..587a4faa --- /dev/null +++ b/src/views/settings/components/inputComponents/RewritePolicyInput.vue @@ -0,0 +1,78 @@ + + + + + diff --git a/src/views/settings/components/inputComponents/index.js b/src/views/settings/components/inputComponents/index.js index 3b6f7aa1..2908e17a 100644 --- a/src/views/settings/components/inputComponents/index.js +++ b/src/views/settings/components/inputComponents/index.js @@ -8,3 +8,4 @@ export { default as ProxyUrlInput } from './ProxyUrlInput' export { default as PruneInput } from './PruneInput' export { default as RateLimitInput } from './RateLimitInput' export { default as RegInvitesInput } from './RegInvitesInput' +export { default as RewritePolicyInput } from './RewritePolicyInput'