0
0
Fork 0

Add setting a always mark media as sensitive (#4136)

This commit is contained in:
Yamagishi Kazutoshi 2017-07-10 21:00:32 +09:00 committed by Eugen Rochko
parent 617208053c
commit 2b9721d1b3
9 changed files with 29 additions and 0 deletions

View file

@ -45,6 +45,7 @@ const initialState = Immutable.Map({
suggestions: Immutable.List(),
me: null,
default_privacy: 'public',
default_sensitive: false,
resetFileKey: Math.floor((Math.random() * 0x10000)),
idempotencyKey: null,
});
@ -75,6 +76,8 @@ function clearAll(state) {
};
function appendMedia(state, media) {
const prevSize = state.get('media_attachments').size;
return state.withMutations(map => {
map.update('media_attachments', list => list.push(media));
map.set('is_uploading', false);
@ -82,6 +85,10 @@ function appendMedia(state, media) {
map.update('text', oldText => `${oldText.trim()} ${media.get('text_url')}`);
map.set('focusDate', new Date());
map.set('idempotencyKey', uuid());
if (prevSize === 0 && state.get('default_sensitive')) {
map.set('sensitive', true);
}
});
};