diff --git a/src/renderer/components/TimelineSpace/Modals/NewToot.vue b/src/renderer/components/TimelineSpace/Modals/NewToot.vue index d12973bcc6..dc579a10b3 100644 --- a/src/renderer/components/TimelineSpace/Modals/NewToot.vue +++ b/src/renderer/components/TimelineSpace/Modals/NewToot.vue @@ -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 } diff --git a/src/renderer/store/TimelineSpace/Modals/NewToot.js b/src/renderer/store/TimelineSpace/Modals/NewToot.js index 0742b3efc3..fe882b1cff 100644 --- a/src/renderer/store/TimelineSpace/Modals/NewToot.js +++ b/src/renderer/store/TimelineSpace/Modals/NewToot.js @@ -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)