about summary refs log tree commit diff
path: root/app/javascript/flavours/glitch/actions
diff options
context:
space:
mode:
authorThibaut Girka <thib@sitedethib.com>2018-03-12 18:39:07 +0100
committerThibaut Girka <thib@sitedethib.com>2018-03-12 18:39:07 +0100
commit841ef606a9b1bc3390830643606b3ec9d65d5120 (patch)
tree74ba0f1cb8611a6e8e52b778ade872f028fb075f /app/javascript/flavours/glitch/actions
parenta0724cd7426dec36b7966c86a1708f62e6e5fd4c (diff)
Remove text requirement when media attached from statuses (fixes #381)
Ports cfa9b6e13ab3c434f3901df6f614d0aa94a3d1ed to glitchsoc
Diffstat (limited to 'app/javascript/flavours/glitch/actions')
-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']),