From fc9f793f2edc8a81c502851d3f7b81499516c0fe Mon Sep 17 00:00:00 2001 From: Yamagishi Kazutoshi Date: Sun, 30 Jul 2017 23:27:57 +0900 Subject: [PATCH] Change to sensitive when adding content warning from web UI (#4456) --- app/javascript/mastodon/reducers/compose.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/javascript/mastodon/reducers/compose.js b/app/javascript/mastodon/reducers/compose.js index 5340220003..1dd49d41a4 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