about summary refs log tree commit diff
path: root/app/assets/javascripts/components
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2017-02-09 20:25:39 +0100
committerEugen Rochko <eugen@zeonfederated.com>2017-02-09 20:25:39 +0100
commit6331ed16e5953e3a006896c6df07b0f82cfd2350 (patch)
treeb1b03e90ccb2feddc65aaf689808658381118228 /app/assets/javascripts/components
parentc424df5192f346dba5332a4b3a2de43b2f028e0c (diff)
Fix #614 - extra reply-boolean on statuses to account for cases when replied-to
status is not in the system at time of distribution; fix #607 - reset privacy
settings to defaults when cancelling replies
Diffstat (limited to 'app/assets/javascripts/components')
-rw-r--r--app/assets/javascripts/components/reducers/compose.jsx9
1 files changed, 8 insertions, 1 deletions
diff --git a/app/assets/javascripts/components/reducers/compose.jsx b/app/assets/javascripts/components/reducers/compose.jsx
index 1b903ed44..042a2c67d 100644
--- a/app/assets/javascripts/components/reducers/compose.jsx
+++ b/app/assets/javascripts/components/reducers/compose.jsx
@@ -81,11 +81,16 @@ function appendMedia(state, media) {
 };
 
 function removeMedia(state, mediaId) {
-  const media = state.get('media_attachments').find(item => item.get('id') === mediaId);
+  const media    = state.get('media_attachments').find(item => item.get('id') === mediaId);
+  const prevSize = state.get('media_attachments').size;
 
   return state.withMutations(map => {
     map.update('media_attachments', list => list.filterNot(item => item.get('id') === mediaId));
     map.update('text', text => text.replace(media.get('text_url'), '').trim());
+
+    if (prevSize === 1) {
+      map.update('sensitive', false);
+    }
   });
 };
 
@@ -126,6 +131,8 @@ export default function compose(state = initialState, action) {
     return state.withMutations(map => {
       map.set('in_reply_to', null);
       map.set('text', '');
+      map.set('unlisted', state.get('default_privacy') === 'unlisted');
+      map.set('private', state.get('default_privacy') === 'private');
     });
   case COMPOSE_SUBMIT_REQUEST:
     return state.set('is_submitting', true);