diff --git a/src/renderer/components/TimelineSpace/Modals/NewToot.vue b/src/renderer/components/TimelineSpace/Modals/NewToot.vue index 88cf8206..8454d266 100644 --- a/src/renderer/components/TimelineSpace/Modals/NewToot.vue +++ b/src/renderer/components/TimelineSpace/Modals/NewToot.vue @@ -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() diff --git a/src/renderer/store/TimelineSpace/Modals/NewToot.js b/src/renderer/store/TimelineSpace/Modals/NewToot.js index bf3db4a8..68ba5577 100644 --- a/src/renderer/store/TimelineSpace/Modals/NewToot.js +++ b/src/renderer/store/TimelineSpace/Modals/NewToot.js @@ -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) },