1
0
mirror of https://github.com/h3poteto/whalebird-desktop synced 2025-02-08 07:48:45 +01:00

refs #461 Set default visibility from preferences in new toot modal

This commit is contained in:
AkiraFukushima 2018-08-02 00:02:44 +09:00
parent 8638bee417
commit af43064700
2 changed files with 19 additions and 2 deletions

View File

@ -147,9 +147,12 @@ export default {
type: 'error'
})
}
const visibilityKey = Object.keys(Visibility).find((key) => {
return Visibility[key].value === this.visibility
})
let form = {
status: this.status,
visibility: this.visibility,
visibility: Visibility[visibilityKey].name,
sensitive: this.sensitive,
spoiler_text: this.spoiler
}

View File

@ -39,12 +39,22 @@ const NewToot = {
},
/**
* changeVisibility
* Update visibility using Visibility constants
* @param state vuex state object
* @param visibility Visibility constants object
**/
changeVisibility (state, visibility) {
state.visibility = visibility.value
},
/**
* changeVisibilityValue
* Update visibility using direct value
* @param state vuex state object
* @param value visibility value
**/
changeVisibilityValue (state, value) {
state.visibility = value
},
changeSensitive (state, value) {
state.sensitive = value
},
@ -79,8 +89,12 @@ const NewToot = {
commit('updateStatus', `${mentionAccounts.map(m => `@${m}`).join(' ')} `)
dispatch('changeVisibility', message.visibility)
},
openModal ({ commit }) {
openModal ({ dispatch, commit }) {
commit('changeModal', true)
ipcRenderer.send('get-preferences')
ipcRenderer.once('response-get-preferences', (event, conf) => {
commit('changeVisibilityValue', conf.general.tootVisibility)
})
},
closeModal ({ commit }) {
commit('changeModal', false)