Skip to content

Commit

Permalink
Merge pull request glitch-soc#755 from ThibG/glitch-soc/features/opti…
Browse files Browse the repository at this point in the history
…onal-reply-selection

Make pre-selection of usernames optional when replying to a toot
  • Loading branch information
hannahwhy authored Sep 30, 2018
2 parents 1996891 + 86b2b00 commit 2bb3c8c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
5 changes: 4 additions & 1 deletion app/javascript/flavours/glitch/features/composer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ function mapStateToProps (state) {
anyMedia: state.getIn(['compose', 'media_attachments']).size > 0,
spoilersAlwaysOn: spoilersAlwaysOn,
mediaDescriptionConfirmation: state.getIn(['local_settings', 'confirm_missing_media_description']),
preselectOnReply: state.getIn(['local_settings', 'preselect_on_reply']),
};
};

Expand Down Expand Up @@ -328,13 +329,14 @@ class Composer extends React.Component {
isSubmitting,
preselectDate,
text,
preselectOnReply,
} = this.props;
let selectionEnd, selectionStart;

// Caret/selection handling.
if (focusDate !== prevProps.focusDate) {
switch (true) {
case preselectDate !== prevProps.preselectDate:
case preselectDate !== prevProps.preselectDate && preselectOnReply:
selectionStart = text.search(/\s/) + 1;
selectionEnd = text.length;
break;
Expand Down Expand Up @@ -534,6 +536,7 @@ Composer.propTypes = {
anyMedia: PropTypes.bool,
spoilersAlwaysOn: PropTypes.bool,
mediaDescriptionConfirmation: PropTypes.bool,
preselectOnReply: PropTypes.bool,

// Dispatch props.
onCancelReply: PropTypes.func,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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' />
</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
settings={settings}
item={['confirm_missing_media_description']}
Expand Down
1 change: 1 addition & 0 deletions app/javascript/flavours/glitch/reducers/local_settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const initialState = ImmutableMap({
show_reply_count : false,
always_show_spoilers_field: false,
confirm_missing_media_description: false,
preselect_on_reply: true,
content_warnings : ImmutableMap({
auto_unfold : false,
filter : null,
Expand Down

0 comments on commit 2bb3c8c

Please sign in to comment.