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 { export default {
name: 'MRF', name: 'MRF',
components: { Setting }, components: { Setting },
// data: function() {
// return {
// removableDoubleOptions: ['replace', 'mrfUserAllowlist'],
// removableSingleOptions: ['keywordReject', 'federatedTimelineRemoval']
// }
// },
computed: { computed: {
...mapGetters([ ...mapGetters([
'settings' '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() { isMobile() {
return this.$store.state.app.device === 'mobile' return this.$store.state.app.device === 'mobile'
}, },
@ -75,121 +60,52 @@ export default {
return this.settings.description.find(setting => setting.key === ':mrf_simple') return this.settings.description.find(setting => setting.key === ':mrf_simple')
}, },
mrfSimpleData() { mrfSimpleData() {
return this.settings.settings[':mrf_simple'] return this.settings.settings.pleroma[':mrf_simple']
}, },
mrfRejectnonpublic() { mrfRejectnonpublic() {
return this.settings.description.find(setting => setting.key === ':mrf_rejectnonpublic') return this.settings.description.find(setting => setting.key === ':mrf_rejectnonpublic')
}, },
mrfRejectnonpublicData() { mrfRejectnonpublicData() {
return this.settings.settings[':mrf_rejectnonpublic'] return this.settings.settings.pleroma[':mrf_rejectnonpublic']
}, },
mrfHellthread() { mrfHellthread() {
return this.settings.description.find(setting => setting.key === ':mrf_hellthread') return this.settings.description.find(setting => setting.key === ':mrf_hellthread')
}, },
mrfHellthreadData() { mrfHellthreadData() {
return this.settings.settings[':mrf_hellthread'] return this.settings.settings.pleroma[':mrf_hellthread']
}, },
mrfKeyword() { mrfKeyword() {
return this.settings.description.find(setting => setting.key === ':mrf_keyword') return this.settings.description.find(setting => setting.key === ':mrf_keyword')
}, },
mrfKeywordData() { mrfKeywordData() {
return this.settings.settings[':mrf_keyword'] return this.settings.settings.pleroma[':mrf_keyword']
}, },
mrfSubchain() { mrfSubchain() {
return this.settings.description.find(setting => setting.key === ':mrf_subchain') return this.settings.description.find(setting => setting.key === ':mrf_subchain')
}, },
mrfSubchainData() { mrfSubchainData() {
return this.settings.settings[':mrf_subchain'] return this.settings.settings.pleroma[':mrf_subchain']
}, },
mrfMention() { mrfMention() {
return this.settings.description.find(setting => setting.key === ':mrf_mention') return this.settings.description.find(setting => setting.key === ':mrf_mention')
}, },
mrfMentionData() { mrfMentionData() {
return this.settings.settings[':mrf_mention'] return this.settings.settings.pleroma[':mrf_mention']
}, },
mrfNormalizeMarkup() { mrfNormalizeMarkup() {
return this.settings.description.find(setting => setting.key === ':mrf_normalize_markup') return this.settings.description.find(setting => setting.key === ':mrf_normalize_markup')
}, },
mrfNormalizeMarkupData() { mrfNormalizeMarkupData() {
return this.settings.settings[':mrf_normalize_markup'] return this.settings.settings.pleroma[':mrf_normalize_markup']
}, },
mrfVocabulary() { mrfVocabulary() {
return this.settings.description.find(setting => setting.key === ':mrf_vocabulary') return this.settings.description.find(setting => setting.key === ':mrf_vocabulary')
}, },
mrfVocabularyData() { mrfVocabularyData() {
return this.settings.settings[':mrf_vocabulary'] return this.settings.settings.pleroma[':mrf_vocabulary']
} }
}, },
methods: { 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() { async onSubmit() {
try { try {
await this.$store.dispatch('SubmitChanges') await this.$store.dispatch('SubmitChanges')

View file

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

View file

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

View file

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

View file

@ -23,7 +23,7 @@ export default {
return this.settings.description.find(setting => setting.key === ':rate_limit') return this.settings.description.find(setting => setting.key === ':rate_limit')
}, },
rateLimitersData() { rateLimitersData() {
return this.settings.settings[':rate_limit'] return this.settings.settings.pleroma[':rate_limit']
}, },
isMobile() { isMobile() {
return this.$store.state.app.device === 'mobile' 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') return this.settings.description.find(setting => setting.key === 'Pleroma.Upload')
}, },
uploadData() { uploadData() {
return this.settings.settings['Pleroma.Upload'] return this.settings.settings.pleroma['Pleroma.Upload']
}, },
uploadersLocal() { uploadersLocal() {
return this.settings.description.find(setting => setting.key === 'Pleroma.Uploaders.Local') return this.settings.description.find(setting => setting.key === 'Pleroma.Uploaders.Local')
}, },
uploadersLocalData() { uploadersLocalData() {
return this.settings.settings['Pleroma.Uploaders.Local'] return this.settings.settings.pleroma['Pleroma.Uploaders.Local']
}, },
uploadersS3() { uploadersS3() {
return this.settings.description.find(setting => setting.key === 'Pleroma.Uploaders.S3') return this.settings.description.find(setting => setting.key === 'Pleroma.Uploaders.S3')
}, },
uploadersS3Data() { uploadersS3Data() {
return this.settings.settings['Pleroma.Uploaders.S3'] return this.settings.settings.pleroma['Pleroma.Uploaders.S3']
}, },
uploadersMDII() { uploadersMDII() {
return this.settings.description.find(setting => setting.key === 'Pleroma.Uploaders.MDII') return this.settings.description.find(setting => setting.key === 'Pleroma.Uploaders.MDII')
}, },
uploadersMDIIData() { uploadersMDIIData() {
return this.settings.settings['Pleroma.Uploaders.MDII'] return this.settings.settings.pleroma['Pleroma.Uploaders.MDII']
}, },
uploadFilterMogrify() { uploadFilterMogrify() {
return this.settings.description.find(setting => setting.key === 'Pleroma.Upload.Filter.Mogrify') return this.settings.description.find(setting => setting.key === 'Pleroma.Upload.Filter.Mogrify')
}, },
uploadFilterMogrifyData() { uploadFilterMogrifyData() {
return this.settings.settings['Pleroma.Upload.Filter.Mogrify'] return this.settings.settings.pleroma['Pleroma.Upload.Filter.Mogrify']
}, },
uploadAnonymizeFilename() { uploadAnonymizeFilename() {
return this.settings.description.find(setting => setting.key === 'Pleroma.Upload.Filter.AnonymizeFilename') return this.settings.description.find(setting => setting.key === 'Pleroma.Upload.Filter.AnonymizeFilename')
}, },
uploadAnonymizeFilenameData() { uploadAnonymizeFilenameData() {
return this.settings.settings['Pleroma.Upload.Filter.AnonymizeFilename'] return this.settings.settings.pleroma['Pleroma.Upload.Filter.AnonymizeFilename']
} }
}, },
methods: { methods: {

View file

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