Merge pull request #755 from ThibG/glitch-soc/features/optional-reply-selection

Make pre-selection of usernames optional when replying to a toot
master
David Yip 6 years ago committed by GitHub
commit 2bb3c8c944
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      app/javascript/flavours/glitch/features/composer/index.js
  2. 8
      app/javascript/flavours/glitch/features/local_settings/page/index.js
  3. 1
      app/javascript/flavours/glitch/reducers/local_settings.js

@ -102,6 +102,7 @@ function mapStateToProps (state) {
anyMedia: state.getIn(['compose', 'media_attachments']).size > 0, anyMedia: state.getIn(['compose', 'media_attachments']).size > 0,
spoilersAlwaysOn: spoilersAlwaysOn, spoilersAlwaysOn: spoilersAlwaysOn,
mediaDescriptionConfirmation: state.getIn(['local_settings', 'confirm_missing_media_description']), mediaDescriptionConfirmation: state.getIn(['local_settings', 'confirm_missing_media_description']),
preselectOnReply: state.getIn(['local_settings', 'preselect_on_reply']),
}; };
}; };
@ -328,13 +329,14 @@ class Composer extends React.Component {
isSubmitting, isSubmitting,
preselectDate, preselectDate,
text, text,
preselectOnReply,
} = this.props; } = this.props;
let selectionEnd, selectionStart; let selectionEnd, selectionStart;
// Caret/selection handling. // Caret/selection handling.
if (focusDate !== prevProps.focusDate) { if (focusDate !== prevProps.focusDate) {
switch (true) { switch (true) {
case preselectDate !== prevProps.preselectDate: case preselectDate !== prevProps.preselectDate && preselectOnReply:
selectionStart = text.search(/\s/) + 1; selectionStart = text.search(/\s/) + 1;
selectionEnd = text.length; selectionEnd = text.length;
break; break;
@ -534,6 +536,7 @@ Composer.propTypes = {
anyMedia: PropTypes.bool, anyMedia: PropTypes.bool,
spoilersAlwaysOn: PropTypes.bool, spoilersAlwaysOn: PropTypes.bool,
mediaDescriptionConfirmation: PropTypes.bool, mediaDescriptionConfirmation: PropTypes.bool,
preselectOnReply: PropTypes.bool,
// Dispatch props. // Dispatch props.
onCancelReply: PropTypes.func, onCancelReply: PropTypes.func,

@ -106,6 +106,14 @@ export default class LocalSettingsPage extends React.PureComponent {
> >
<FormattedMessage id='settings.always_show_spoilers_field' defaultMessage='Always enable the Content Warning field' /> <FormattedMessage id='settings.always_show_spoilers_field' defaultMessage='Always enable the Content Warning field' />
</LocalSettingsPageItem> </LocalSettingsPageItem>
<LocalSettingsPageItem
settings={settings}
item={['preselect_on_reply']}
id='mastodon-settings--preselect_on_reply'
onChange={onChange}
>
<FormattedMessage id='settings.preselect_on_reply' defaultMessage='Pre-select usernames past the first when replying to a toot with multiple participants' />
</LocalSettingsPageItem>
<LocalSettingsPageItem <LocalSettingsPageItem
settings={settings} settings={settings}
item={['confirm_missing_media_description']} item={['confirm_missing_media_description']}

@ -14,6 +14,7 @@ const initialState = ImmutableMap({
show_reply_count : false, show_reply_count : false,
always_show_spoilers_field: false, always_show_spoilers_field: false,
confirm_missing_media_description: false, confirm_missing_media_description: false,
preselect_on_reply: true,
content_warnings : ImmutableMap({ content_warnings : ImmutableMap({
auto_unfold : false, auto_unfold : false,
filter : null, filter : null,

Loading…
Cancel
Save