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:
parent
38fb45bb2f
commit
3abc8554ef
@ -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()
|
||||
|
@ -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)
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user