1
0
mirror of https://github.com/h3poteto/whalebird-desktop synced 2024-12-23 23:47:57 +01:00

refs #118 Attach image in toot

This commit is contained in:
AkiraFukushima 2018-03-29 13:16:15 +09:00
parent 38fb45bb2f
commit 3abc8554ef
2 changed files with 16 additions and 0 deletions

View File

@ -101,6 +101,17 @@ export default {
in_reply_to_id: this.replyToId
})
}
if (this.attachedMedias.length > 0) {
if (this.attachedMedias.length > 4) {
return this.$message({
message: 'You can only attach up to 4 images',
type: 'error'
})
}
form = Object.assign(form, {
media_ids: this.attachedMedias.map((m) => { return m.id })
})
}
this.$store.dispatch('TimelineSpace/Modals/NewToot/postToot', form)
.then(() => {
this.close()

View File

@ -25,6 +25,9 @@ const NewToot = {
},
appendAttachedMedias (state, media) {
state.attachedMedias = state.attachedMedias.concat([media])
},
clearAttachedMedias (state) {
state.attachedMedias = []
}
},
actions: {
@ -54,6 +57,8 @@ const NewToot = {
if (!value) {
commit('updateStatus', '')
commit('setReplyTo', null)
commit('changeBlockSubmit', false)
commit('clearAttachedMedias')
}
commit('changeModal', value)
},