about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAsh Levy <ashlea@protonmail.com>2018-07-08 21:24:51 -0400
committerThibG <thib@sitedethib.com>2018-07-12 11:22:34 +0200
commit6f06d16b1e74e8cb0f197d0c12651c875ded51c3 (patch)
tree34c7241b909edb1378ae56ee297d287ff55c4ba4
parent7cb7ecaf7ee10c74066ef20cd08d9004de738c15 (diff)
add option to enable auto visibility on secondary toot button
-rw-r--r--app/javascript/flavours/glitch/features/composer/index.js2
-rw-r--r--app/javascript/flavours/glitch/features/local_settings/page/index.js8
-rw-r--r--app/javascript/flavours/glitch/reducers/compose.js3
-rw-r--r--app/javascript/flavours/glitch/reducers/local_settings.js1
4 files changed, 13 insertions, 1 deletions
diff --git a/app/javascript/flavours/glitch/features/composer/index.js b/app/javascript/flavours/glitch/features/composer/index.js
index 95cb93f30..72948253d 100644
--- a/app/javascript/flavours/glitch/features/composer/index.js
+++ b/app/javascript/flavours/glitch/features/composer/index.js
@@ -67,7 +67,7 @@ function mapStateToProps (state) {
     replyAccount: inReplyTo ? state.getIn(['statuses', inReplyTo, 'account']) : null,
     replyContent: inReplyTo ? state.getIn(['statuses', inReplyTo, 'contentHtml']) : null,
     resetFileKey: state.getIn(['compose', 'resetFileKey']),
-    sideArm: state.getIn(['local_settings', 'side_arm']),
+    sideArm: (state.getIn(['local_settings', 'side_arm_auto']) ? state.getIn(['compose', 'reply_privacy']) : null) || state.getIn(['local_settings', 'side_arm']),
     sensitive: state.getIn(['compose', 'sensitive']),
     showSearch: state.getIn(['search', 'submitted']) && !state.getIn(['search', 'hidden']),
     spoiler: state.getIn(['compose', 'spoiler']),
diff --git a/app/javascript/flavours/glitch/features/local_settings/page/index.js b/app/javascript/flavours/glitch/features/local_settings/page/index.js
index 62bf410c6..8a09bb6f0 100644
--- a/app/javascript/flavours/glitch/features/local_settings/page/index.js
+++ b/app/javascript/flavours/glitch/features/local_settings/page/index.js
@@ -76,6 +76,14 @@ export default class LocalSettingsPage extends React.PureComponent {
           >
             <FormattedMessage id='settings.side_arm' defaultMessage='Secondary toot button:' />
           </LocalSettingsPageItem>
+          <LocalSettingsPageItem
+            settings={settings}
+            item={['side_arm_auto']}
+            id='mastodon-settings--side_arm_auto'
+            onChange={onChange}
+          >
+            <FormattedMessage id='settings.side_arm_auto' defaultMessage='Auto privacy for secondary toot button' />
+          </LocalSettingsPageItem>
         </section>
       </div>
     ),
diff --git a/app/javascript/flavours/glitch/reducers/compose.js b/app/javascript/flavours/glitch/reducers/compose.js
index a7ce71676..c04fe545f 100644
--- a/app/javascript/flavours/glitch/reducers/compose.js
+++ b/app/javascript/flavours/glitch/reducers/compose.js
@@ -56,6 +56,7 @@ const initialState = ImmutableMap({
   spoiler: false,
   spoiler_text: '',
   privacy: null,
+  reply_privacy: null,
   text: '',
   focusDate: null,
   caretPosition: null,
@@ -290,6 +291,7 @@ export default function compose(state = initialState, action) {
       map.set('in_reply_to', action.status.get('id'));
       map.set('text', statusToTextMentions(state, action.status));
       map.set('privacy', privacyPreference(action.status.get('visibility'), state.get('default_privacy')));
+      map.set('reply_privacy', action.status.get('visibility'));
       map.update(
         'advanced_options',
         map => map.merge(new ImmutableMap({ do_not_federate: /👁\ufe0f?\u200b?(?:<\/p>)?$/.test(action.status.get('content')) }))
@@ -315,6 +317,7 @@ export default function compose(state = initialState, action) {
       map.set('spoiler', false);
       map.set('spoiler_text', '');
       map.set('privacy', state.get('default_privacy'));
+      map.set('reply_privacy', null);
       map.update(
         'advanced_options',
         map => map.mergeWith(overwrite, state.get('default_advanced_options'))
diff --git a/app/javascript/flavours/glitch/reducers/local_settings.js b/app/javascript/flavours/glitch/reducers/local_settings.js
index 69d98741b..ee04747c5 100644
--- a/app/javascript/flavours/glitch/reducers/local_settings.js
+++ b/app/javascript/flavours/glitch/reducers/local_settings.js
@@ -10,6 +10,7 @@ const initialState = ImmutableMap({
   stretch   : true,
   navbar_under : false,
   side_arm  : 'none',
+  side_arm_auto : false,
   collapsed : ImmutableMap({
     enabled     : true,
     auto        : ImmutableMap({