about summary refs log tree commit diff
diff options
context:
space:
mode:
authorYamagishi Kazutoshi <ykzts@desire.sh>2017-07-30 23:27:57 +0900
committerEugen Rochko <eugen@zeonfederated.com>2017-07-30 16:27:57 +0200
commit970297a13887ff253ce2d65822ccd77a4e56c82e (patch)
treea834563c09f039ecb04161934e567f2232610e98
parent29abc9438c35f81e862813d40d730b6164ea295a (diff)
Change to sensitive when adding content warning from web UI (#4456)
-rw-r--r--app/javascript/mastodon/reducers/compose.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/app/javascript/mastodon/reducers/compose.js b/app/javascript/mastodon/reducers/compose.js
index 534022000..1dd49d41a 100644
--- a/app/javascript/mastodon/reducers/compose.js
+++ b/app/javascript/mastodon/reducers/compose.js
@@ -88,7 +88,7 @@ function appendMedia(state, media) {
     map.set('focusDate', new Date());
     map.set('idempotencyKey', uuid());
 
-    if (prevSize === 0 && state.get('default_sensitive')) {
+    if (prevSize === 0 && (state.get('default_sensitive') || state.get('spoiler'))) {
       map.set('sensitive', true);
     }
   });
@@ -160,6 +160,10 @@ export default function compose(state = initialState, action) {
       map.set('spoiler_text', '');
       map.set('spoiler', !state.get('spoiler'));
       map.set('idempotencyKey', uuid());
+
+      if (!state.get('sensitive') && state.get('media_attachments').size >= 1) {
+        map.set('sensitive', true);
+      }
     });
   case COMPOSE_SPOILER_TEXT_CHANGE:
     return state