add option to enable auto visibility on secondary toot button

This commit is contained in:
Ash Levy 2018-07-08 21:24:51 -04:00 committed by ThibG
parent 7cb7ecaf7e
commit 6f06d16b1e
4 changed files with 13 additions and 1 deletions

View file

@ -67,7 +67,7 @@ function mapStateToProps (state) {
replyAccount: inReplyTo ? state.getIn(['statuses', inReplyTo, 'account']) : null, replyAccount: inReplyTo ? state.getIn(['statuses', inReplyTo, 'account']) : null,
replyContent: inReplyTo ? state.getIn(['statuses', inReplyTo, 'contentHtml']) : null, replyContent: inReplyTo ? state.getIn(['statuses', inReplyTo, 'contentHtml']) : null,
resetFileKey: state.getIn(['compose', 'resetFileKey']), 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']), sensitive: state.getIn(['compose', 'sensitive']),
showSearch: state.getIn(['search', 'submitted']) && !state.getIn(['search', 'hidden']), showSearch: state.getIn(['search', 'submitted']) && !state.getIn(['search', 'hidden']),
spoiler: state.getIn(['compose', 'spoiler']), spoiler: state.getIn(['compose', 'spoiler']),

View file

@ -76,6 +76,14 @@ export default class LocalSettingsPage extends React.PureComponent {
> >
<FormattedMessage id='settings.side_arm' defaultMessage='Secondary toot button:' /> <FormattedMessage id='settings.side_arm' defaultMessage='Secondary toot button:' />
</LocalSettingsPageItem> </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> </section>
</div> </div>
), ),

View file

@ -56,6 +56,7 @@ const initialState = ImmutableMap({
spoiler: false, spoiler: false,
spoiler_text: '', spoiler_text: '',
privacy: null, privacy: null,
reply_privacy: null,
text: '', text: '',
focusDate: null, focusDate: null,
caretPosition: 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('in_reply_to', action.status.get('id'));
map.set('text', statusToTextMentions(state, action.status)); map.set('text', statusToTextMentions(state, action.status));
map.set('privacy', privacyPreference(action.status.get('visibility'), state.get('default_privacy'))); map.set('privacy', privacyPreference(action.status.get('visibility'), state.get('default_privacy')));
map.set('reply_privacy', action.status.get('visibility'));
map.update( map.update(
'advanced_options', 'advanced_options',
map => map.merge(new ImmutableMap({ do_not_federate: /👁\ufe0f?\u200b?(?:<\/p>)?$/.test(action.status.get('content')) })) 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', false);
map.set('spoiler_text', ''); map.set('spoiler_text', '');
map.set('privacy', state.get('default_privacy')); map.set('privacy', state.get('default_privacy'));
map.set('reply_privacy', null);
map.update( map.update(
'advanced_options', 'advanced_options',
map => map.mergeWith(overwrite, state.get('default_advanced_options')) map => map.mergeWith(overwrite, state.get('default_advanced_options'))

View file

@ -10,6 +10,7 @@ const initialState = ImmutableMap({
stretch : true, stretch : true,
navbar_under : false, navbar_under : false,
side_arm : 'none', side_arm : 'none',
side_arm_auto : false,
collapsed : ImmutableMap({ collapsed : ImmutableMap({
enabled : true, enabled : true,
auto : ImmutableMap({ auto : ImmutableMap({