about summary refs log tree commit diff
path: root/app/javascript/flavours/glitch/actions/compose.js
diff options
context:
space:
mode:
authorGô Shoemake <marrus-sh@users.noreply.github.com>2018-03-12 13:09:42 -0700
committerGitHub <noreply@github.com>2018-03-12 13:09:42 -0700
commit22f2750578c64af4e886b0cc704aa0be4ee209b0 (patch)
treee78dcbda318956c4d642a3bd16f23b3862cb6113 /app/javascript/flavours/glitch/actions/compose.js
parent2395a4c31323e5c1433fbf232cd6c52e516a72f5 (diff)
parent841ef606a9b1bc3390830643606b3ec9d65d5120 (diff)
Merge pull request #384 from ThibG/glitch-soc/features/no-media-url
Remove text requirement when media attached from statuses (fixes #381)
Diffstat (limited to 'app/javascript/flavours/glitch/actions/compose.js')
-rw-r--r--app/javascript/flavours/glitch/actions/compose.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/app/javascript/flavours/glitch/actions/compose.js b/app/javascript/flavours/glitch/actions/compose.js
index c46387104..1e9386859 100644
--- a/app/javascript/flavours/glitch/actions/compose.js
+++ b/app/javascript/flavours/glitch/actions/compose.js
@@ -102,8 +102,9 @@ export function mentionCompose(account, router) {
 export function submitCompose() {
   return function (dispatch, getState) {
     let status = getState().getIn(['compose', 'text'], '');
+    let media  = getState().getIn(['compose', 'media_attachments']);
 
-    if (!status || !status.length) {
+    if ((!status || !status.length) && media.size === 0) {
       return;
     }
 
@@ -114,7 +115,7 @@ export function submitCompose() {
     api(getState).post('/api/v1/statuses', {
       status,
       in_reply_to_id: getState().getIn(['compose', 'in_reply_to'], null),
-      media_ids: getState().getIn(['compose', 'media_attachments']).map(item => item.get('id')),
+      media_ids: media.map(item => item.get('id')),
       sensitive: getState().getIn(['compose', 'sensitive']),
       spoiler_text: getState().getIn(['compose', 'spoiler_text'], ''),
       visibility: getState().getIn(['compose', 'privacy']),