about summary refs log tree commit diff
path: root/app/javascript/flavours/glitch/features/compose/containers/options_container.js
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2019-11-07 08:07:03 +0100
committerThibaut Girka <thib@sitedethib.com>2019-11-07 14:31:53 +0100
commit44acac0dcd999c66137eb8dbe20c0438c4b74a6e (patch)
treed2ca4ea04902b753b71e4dde48841921940ac352 /app/javascript/flavours/glitch/features/compose/containers/options_container.js
parent83774367d25fd5ad3f9a7b103bea30c13c9e03d8 (diff)
[Glitch] Fix WebUI allowing to upload more items than the limit
Port 66684c489c3c0bde752d107b02fc3bd6cbcacf04 to glitch-soc

Signed-off-by: Thibaut Girka <thib@sitedethib.com>
Diffstat (limited to 'app/javascript/flavours/glitch/features/compose/containers/options_container.js')
-rw-r--r--app/javascript/flavours/glitch/features/compose/containers/options_container.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/app/javascript/flavours/glitch/features/compose/containers/options_container.js b/app/javascript/flavours/glitch/features/compose/containers/options_container.js
index df842f3bf..c792aa582 100644
--- a/app/javascript/flavours/glitch/features/compose/containers/options_container.js
+++ b/app/javascript/flavours/glitch/features/compose/containers/options_container.js
@@ -12,11 +12,12 @@ function mapStateToProps (state) {
   const spoilersAlwaysOn = state.getIn(['local_settings', 'always_show_spoilers_field']);
   const poll = state.getIn(['compose', 'poll']);
   const media = state.getIn(['compose', 'media_attachments']);
+  const pending_media = state.getIn(['compose', 'pending_media_attachments']);
   return {
     acceptContentTypes: state.getIn(['media_attachments', 'accept_content_types']).toArray().join(','),
     resetFileKey: state.getIn(['compose', 'resetFileKey']),
     hasPoll: !!poll,
-    allowMedia: !poll && (media ? media.size < 4 && !media.some(item => ['video', 'audio'].includes(item.get('type'))) : true),
+    allowMedia: !poll && (media ? media.size + pending_media < 4 && !media.some(item => ['video', 'audio'].includes(item.get('type'))) : pending_media < 4),
     hasMedia: media && !!media.size,
     allowPoll: !(media && !!media.size),
     showContentTypeChoice: state.getIn(['local_settings', 'show_content_type_choice']),