Update computed values for Mailer, MediaProxy, Metadata, MRF, Upload, RateLimiters and WebPush tabs

This commit is contained in:
Angelina Filippova 2019-11-20 22:46:17 +09:00
parent 01dfa80bc9
commit f4302fbc47
7 changed files with 22 additions and 106 deletions

View file

@ -43,25 +43,10 @@ import Setting from './Setting'
export default {
name: 'MRF',
components: { Setting },
// data: function() {
// return {
// removableDoubleOptions: ['replace', 'mrfUserAllowlist'],
// removableSingleOptions: ['keywordReject', 'federatedTimelineRemoval']
// }
// },
computed: {
...mapGetters([
'settings'
]),
// matchActor() {
// return Object.keys(this.mrfSubchain.match_actor).map(key => [key, this.mrfSubchain.match_actor[key]])
// },
// replacePatterns() {
// return Object.keys(this.mrfKeyword.replace).map(key => [key, this.mrfKeyword.replace[key]])
// },
// userAllowlist() {
// return Object.keys(this.mrfUserAllowlist).map(key => [key, this.mrfUserAllowlist[key]])
// },
isMobile() {
return this.$store.state.app.device === 'mobile'
},
@ -75,121 +60,52 @@ export default {
return this.settings.description.find(setting => setting.key === ':mrf_simple')
},
mrfSimpleData() {
return this.settings.settings[':mrf_simple']
return this.settings.settings.pleroma[':mrf_simple']
},
mrfRejectnonpublic() {
return this.settings.description.find(setting => setting.key === ':mrf_rejectnonpublic')
},
mrfRejectnonpublicData() {
return this.settings.settings[':mrf_rejectnonpublic']
return this.settings.settings.pleroma[':mrf_rejectnonpublic']
},
mrfHellthread() {
return this.settings.description.find(setting => setting.key === ':mrf_hellthread')
},
mrfHellthreadData() {
return this.settings.settings[':mrf_hellthread']
return this.settings.settings.pleroma[':mrf_hellthread']
},
mrfKeyword() {
return this.settings.description.find(setting => setting.key === ':mrf_keyword')
},
mrfKeywordData() {
return this.settings.settings[':mrf_keyword']
return this.settings.settings.pleroma[':mrf_keyword']
},
mrfSubchain() {
return this.settings.description.find(setting => setting.key === ':mrf_subchain')
},
mrfSubchainData() {
return this.settings.settings[':mrf_subchain']
return this.settings.settings.pleroma[':mrf_subchain']
},
mrfMention() {
return this.settings.description.find(setting => setting.key === ':mrf_mention')
},
mrfMentionData() {
return this.settings.settings[':mrf_mention']
return this.settings.settings.pleroma[':mrf_mention']
},
mrfNormalizeMarkup() {
return this.settings.description.find(setting => setting.key === ':mrf_normalize_markup')
},
mrfNormalizeMarkupData() {
return this.settings.settings[':mrf_normalize_markup']
return this.settings.settings.pleroma[':mrf_normalize_markup']
},
mrfVocabulary() {
return this.settings.description.find(setting => setting.key === ':mrf_vocabulary')
},
mrfVocabularyData() {
return this.settings.settings[':mrf_vocabulary']
return this.settings.settings.pleroma[':mrf_vocabulary']
}
},
methods: {
// addMrfSubchainRow() {
// const updatedValue = this.matchActor.reduce((acc, el, i) => {
// return { ...acc, [el[0]]: el[1] }
// }, {})
// this.updateSetting({ ...updatedValue, '': [] }, 'mrf_subchain', 'match_actor')
// },
// addMrfUserAllowlistRow() {
// const updatedValue = this.userAllowlist.reduce((acc, el, i) => {
// return { ...acc, [el[0]]: el[1] }
// }, {})
// this.$store.dispatch('RewriteConfig', { data: { ...updatedValue, '': [] }, tab: 'mrf_user_allowlist' })
// },
// addReplaceRow() {
// const updatedValue = this.replacePatterns.reduce((acc, el, i) => {
// return { ...acc, [el[0]]: el[1] }
// }, {})
// this.updateSetting({ ...updatedValue, '': '' }, 'mrf_keyword', 'replace')
// },
// deleteMrfSubchainRow(index) {
// const filteredValues = this.matchActor.filter((el, i) => index !== i)
// const updatedValue = filteredValues.reduce((acc, el, i) => {
// return { ...acc, [el[0]]: el[1] }
// }, {})
// this.updateSetting(updatedValue, 'mrf_subchain', 'match_actor')
// },
// deleteMrfUserAllowlistRow(index) {
// const filteredValues = this.userAllowlist.filter((el, i) => index !== i)
// const updatedValue = filteredValues.reduce((acc, el, i) => {
// return { ...acc, [el[0]]: el[1] }
// }, {})
// this.$store.dispatch('RewriteConfig', { data: updatedValue, tab: 'mrf_user_allowlist' })
// },
// deleteReplaceRow(index) {
// const filteredValues = this.replacePatterns.filter((el, i) => index !== i)
// const updatedValue = filteredValues.reduce((acc, el, i) => {
// return { ...acc, [el[0]]: el[1] }
// }, {})
// this.updateSetting(updatedValue, 'mrf_keyword', 'replace')
// },
// parseMrfSubchain(value, inputType, index) {
// const updatedValue = this.matchActor.reduce((acc, el, i) => {
// if (index === i) {
// return inputType === 'regExp' ? { ...acc, [value]: el[1] } : { ...acc, [el[0]]: value }
// }
// return { ...acc, [el[0]]: el[1] }
// }, {})
// this.updateSetting(updatedValue, 'mrf_subchain', 'match_actor')
// },
// parseMrfUserAllowlist(value, inputType, index) {
// const updatedValue = this.userAllowlist.reduce((acc, el, i) => {
// if (index === i) {
// return inputType === 'domain' ? { ...acc, [value]: el[1] } : { ...acc, [el[0]]: value }
// }
// return { ...acc, [el[0]]: el[1] }
// }, {})
// this.$store.dispatch('RewriteConfig', { data: updatedValue, tab: 'mrf_user_allowlist' })
// },
// parseReplace(value, inputType, index) {
// const updatedValue = this.replacePatterns.reduce((acc, el, i) => {
// if (index === i) {
// return inputType === 'key' ? { ...acc, [value]: el[1] } : { ...acc, [el[0]]: value }
// }
// return { ...acc, [el[0]]: el[1] }
// }, {})
// this.updateSetting(updatedValue, 'mrf_keyword', 'replace')
// },
// updateSetting(value, tab, input) {
// this.$store.dispatch('UpdateSettings', { tab, data: { [input]: value }})
// },
async onSubmit() {
try {
await this.$store.dispatch('SubmitChanges')

View file

@ -34,7 +34,7 @@ export default {
return this.settings.description.find(setting => setting.key === ':email_notifications')
},
emailNotificationsData() {
return this.settings.settings[':email_notifications']
return this.settings.settings.pleroma[':email_notifications']
},
isMobile() {
return this.$store.state.app.device === 'mobile'
@ -49,13 +49,13 @@ export default {
return this.settings.description.find(setting => setting.key === 'Pleroma.Emails.Mailer')
},
mailerData() {
return this.settings.settings['Pleroma.Emails.Mailer']
return this.settings.settings.pleroma['Pleroma.Emails.Mailer']
},
userEmail() {
return this.settings.description.find(setting => setting.key === 'Pleroma.Emails.UserEmail')
},
userEmailData() {
return this.settings.settings['Pleroma.Emails.UserEmail']
return this.settings.settings.pleroma['Pleroma.Emails.UserEmail']
}
},
methods: {

View file

@ -32,7 +32,7 @@ export default {
return this.settings.description.find(setting => setting.key === ':media_proxy')
},
mediaProxyData() {
return this.settings.settings[':media_proxy']
return this.settings.settings.pleroma[':media_proxy']
}
},
methods: {

View file

@ -38,13 +38,13 @@ export default {
return this.settings.description.find(setting => setting.key === 'Pleroma.Web.Metadata')
},
metadataData() {
return this.settings.settings['Pleroma.Web.Metadata']
return this.settings.settings.pleroma['Pleroma.Web.Metadata']
},
richMedia() {
return this.settings.description.find(setting => setting.key === ':rich_media')
},
richMediaData() {
return this.settings.settings[':rich_media']
return this.settings.settings.pleroma[':rich_media']
}
},
methods: {

View file

@ -23,7 +23,7 @@ export default {
return this.settings.description.find(setting => setting.key === ':rate_limit')
},
rateLimitersData() {
return this.settings.settings[':rate_limit']
return this.settings.settings.pleroma[':rate_limit']
},
isMobile() {
return this.$store.state.app.device === 'mobile'

View file

@ -53,37 +53,37 @@ export default {
return this.settings.description.find(setting => setting.key === 'Pleroma.Upload')
},
uploadData() {
return this.settings.settings['Pleroma.Upload']
return this.settings.settings.pleroma['Pleroma.Upload']
},
uploadersLocal() {
return this.settings.description.find(setting => setting.key === 'Pleroma.Uploaders.Local')
},
uploadersLocalData() {
return this.settings.settings['Pleroma.Uploaders.Local']
return this.settings.settings.pleroma['Pleroma.Uploaders.Local']
},
uploadersS3() {
return this.settings.description.find(setting => setting.key === 'Pleroma.Uploaders.S3')
},
uploadersS3Data() {
return this.settings.settings['Pleroma.Uploaders.S3']
return this.settings.settings.pleroma['Pleroma.Uploaders.S3']
},
uploadersMDII() {
return this.settings.description.find(setting => setting.key === 'Pleroma.Uploaders.MDII')
},
uploadersMDIIData() {
return this.settings.settings['Pleroma.Uploaders.MDII']
return this.settings.settings.pleroma['Pleroma.Uploaders.MDII']
},
uploadFilterMogrify() {
return this.settings.description.find(setting => setting.key === 'Pleroma.Upload.Filter.Mogrify')
},
uploadFilterMogrifyData() {
return this.settings.settings['Pleroma.Upload.Filter.Mogrify']
return this.settings.settings.pleroma['Pleroma.Upload.Filter.Mogrify']
},
uploadAnonymizeFilename() {
return this.settings.description.find(setting => setting.key === 'Pleroma.Upload.Filter.AnonymizeFilename')
},
uploadAnonymizeFilenameData() {
return this.settings.settings['Pleroma.Upload.Filter.AnonymizeFilename']
return this.settings.settings.pleroma['Pleroma.Upload.Filter.AnonymizeFilename']
}
},
methods: {

View file

@ -32,7 +32,7 @@ export default {
return this.settings.description.find(setting => setting.key === ':vapid_details')
},
vapidDetailsData() {
return this.settings.settings[':vapid_details']
return this.settings.settings.web_push_encryption[':vapid_details']
}
},
methods: {