about summary refs log tree commit diff
path: root/app/javascript
diff options
context:
space:
mode:
authorYamagishi Kazutoshi <ykzts@desire.sh>2017-07-10 21:00:32 +0900
committerEugen Rochko <eugen@zeonfederated.com>2017-07-10 14:00:32 +0200
commit2b9721d1b38319d70bed98e76a0fe1d648780298 (patch)
tree4e1994def2b461c88b86eea164aa1223069878fb /app/javascript
parent617208053c2bf935d2dd3944bb2b9192a388f0b4 (diff)
Add setting a always mark media as sensitive (#4136)
Diffstat (limited to 'app/javascript')
-rw-r--r--app/javascript/mastodon/reducers/compose.js7
1 files changed, 7 insertions, 0 deletions
diff --git a/app/javascript/mastodon/reducers/compose.js b/app/javascript/mastodon/reducers/compose.js
index d0b47a85c..752377739 100644
--- a/app/javascript/mastodon/reducers/compose.js
+++ b/app/javascript/mastodon/reducers/compose.js
@@ -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);
+    }
   });
 };