Add mailer tab, fix rendering and processing emails mailer settings

This commit is contained in:
Angelina Filippova 2019-12-20 03:42:00 +03:00
parent 961bf8ae0c
commit a80374838f
3 changed files with 14 additions and 6 deletions

View file

@ -45,13 +45,15 @@ const settings = {
state.settings = newSettings state.settings = newSettings
}, },
UPDATE_SETTINGS: (state, { group, key, input, value, type }) => { UPDATE_SETTINGS: (state, { group, key, input, value, type }) => {
const updatedSetting = state.updatedSettings[group] const updatedSetting = !state.updatedSettings[group] || (key === 'Pleroma.Emails.Mailer' && input === ':adapter')
? { [key]: { ...state.updatedSettings[group][key], ...{ [input]: [type, value] }}} ? { [key]: { [input]: [type, value] }}
: { [key]: { [input]: [type, value] }} : { [key]: { ...state.updatedSettings[group][key], ...{ [input]: [type, value] }}}
state.updatedSettings[group] = { ...state.updatedSettings[group], ...updatedSetting } state.updatedSettings[group] = { ...state.updatedSettings[group], ...updatedSetting }
}, },
UPDATE_STATE: (state, { group, key, input, value }) => { UPDATE_STATE: (state, { group, key, input, value }) => {
const updatedState = { [key]: { ...state.settings[group][key], ...{ [input]: value }}} const updatedState = key === 'Pleroma.Emails.Mailer' && input === ':adapter'
? { [key]: { [input]: value }}
: { [key]: { ...state.settings[group][key], ...{ [input]: value }}}
state.settings[group] = { ...state.settings[group], ...updatedState } state.settings[group] = { ...state.settings[group], ...updatedState }
} }
}, },

View file

@ -11,9 +11,8 @@
:data="data"/> :data="data"/>
</div> </div>
<div <div
v-for="setting in settingGroup.children.filter(setting => setting.group && setting.group.includes(setting.key))" v-for="setting in emailAdapterChildren"
:key="setting.key"> :key="setting.key">
<div class="line"/>
<inputs <inputs
:setting-group="settingGroup" :setting-group="settingGroup"
:setting="setting" :setting="setting"
@ -76,6 +75,10 @@ export default {
} }
}, },
computed: { computed: {
emailAdapterChildren() {
const adapter = this.$store.state.settings.settings[':pleroma']['Pleroma.Emails.Mailer'][':adapter']
return this.settingGroup.children.filter(child => child.group && child.group.includes(adapter))
},
loading() { loading() {
return this.$store.state.settings.loading return this.$store.state.settings.loading
} }

View file

@ -41,6 +41,9 @@
<el-tab-pane :label="$t('settings.logger')" lazy> <el-tab-pane :label="$t('settings.logger')" lazy>
<logger/> <logger/>
</el-tab-pane> </el-tab-pane>
<el-tab-pane :label="$t('settings.mailer')" lazy>
<mailer/>
</el-tab-pane>
<!-- <!--
<el-tab-pane :label="$t('settings.jobQueue')" lazy> <el-tab-pane :label="$t('settings.jobQueue')" lazy>
<job-queue/> <job-queue/>