refs #380 Set visibility from source message when reply

This commit is contained in:
AkiraFukushima 2018-06-19 22:44:33 +09:00
parent 75b16fff33
commit 31cb1a8fff
4 changed files with 22 additions and 15 deletions

View File

@ -70,7 +70,7 @@ export default {
}
},
openNewTootModal () {
this.$store.commit('TimelineSpace/Modals/NewToot/changeModal', true)
this.$store.dispatch('TimelineSpace/Modals/NewToot/openModal')
}
}
}

View File

@ -97,7 +97,11 @@ export default {
return this.$store.state.TimelineSpace.Modals.NewToot.modalOpen
},
set (value) {
this.$store.dispatch('TimelineSpace/Modals/NewToot/changeModal', value)
if (value) {
this.$store.dispatch('TimelineSpace/Modals/NewToot/openModal')
} else {
this.$store.dispatch('TimelineSpace/Modals/NewToot/closeModal')
}
}
},
status: {
@ -136,7 +140,7 @@ export default {
methods: {
close () {
this.resetImage()
this.$store.dispatch('TimelineSpace/Modals/NewToot/changeModal', false)
this.$store.dispatch('TimelineSpace/Modals/NewToot/closeModal')
},
toot () {
if (!this.newTootModal) {

View File

@ -121,9 +121,9 @@ const TimelineSpace = {
ipcRenderer.send('stop-local-streaming')
return 'stopLocalStreaming'
},
watchShortcutEvents ({ commit }) {
watchShortcutEvents ({ commit, dispatch }) {
ipcRenderer.on('CmdOrCtrl+N', () => {
commit('TimelineSpace/Modals/NewToot/changeModal', true, { root: true })
dispatch('TimelineSpace/Modals/NewToot/openModal', {}, { root: true })
})
ipcRenderer.on('CmdOrCtrl+K', () => {
commit('TimelineSpace/Modals/Jump/changeModal', true, { root: true })

View File

@ -65,19 +65,22 @@ const NewToot = {
const mentionAccounts = [message.account.acct].concat(message.mentions.map(a => a.acct))
.filter((a, i, self) => self.indexOf(a) === i)
.filter((a) => a !== rootState.TimelineSpace.account.username)
commit('changeModal', true)
commit('updateStatus', `${mentionAccounts.map(m => `@${m}`).join(' ')} `)
commit('changeVisibility', message.visibility)
},
openModal ({ commit }) {
commit('changeModal', true)
},
changeModal ({ commit }, value) {
commit('changeModal', value)
if (!value) {
commit('updateStatus', '')
commit('setReplyTo', null)
commit('changeBlockSubmit', false)
commit('clearAttachedMedias')
commit('changeSensitive', false)
commit('updateSpoiler', '')
}
closeModal ({ commit }) {
commit('changeModal', false)
commit('updateStatus', '')
commit('setReplyTo', null)
commit('changeBlockSubmit', false)
commit('clearAttachedMedias')
commit('changeSensitive', false)
commit('updateSpoiler', '')
commit('changeVisibility', 'public')
},
uploadImage ({ state, commit, rootState }, image) {
commit('changeBlockSubmit', true)