Change to sensitive when adding content warning from web UI (#4456)

This commit is contained in:
Yamagishi Kazutoshi 2017-07-30 23:27:57 +09:00 committed by Eugen Rochko
parent 29abc9438c
commit 970297a138
1 changed files with 5 additions and 1 deletions

View File

@ -88,7 +88,7 @@ function appendMedia(state, media) {
map.set('focusDate', new Date()); map.set('focusDate', new Date());
map.set('idempotencyKey', uuid()); 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); map.set('sensitive', true);
} }
}); });
@ -160,6 +160,10 @@ export default function compose(state = initialState, action) {
map.set('spoiler_text', ''); map.set('spoiler_text', '');
map.set('spoiler', !state.get('spoiler')); map.set('spoiler', !state.get('spoiler'));
map.set('idempotencyKey', uuid()); map.set('idempotencyKey', uuid());
if (!state.get('sensitive') && state.get('media_attachments').size >= 1) {
map.set('sensitive', true);
}
}); });
case COMPOSE_SPOILER_TEXT_CHANGE: case COMPOSE_SPOILER_TEXT_CHANGE:
return state return state