Make prepending “re: ” to CWs on reply optional

This commit is contained in:
Thibaut Girka 2020-01-07 18:11:50 +01:00 committed by ThibG
parent 9871466958
commit 180f138394
4 changed files with 12 additions and 1 deletions

View File

@ -91,9 +91,11 @@ export function cycleElefriendCompose() {
export function replyCompose(status, routerHistory) {
return (dispatch, getState) => {
const prependCWRe = getState().getIn(['local_settings', 'prepend_cw_re']);
dispatch({
type: COMPOSE_REPLY,
status: status,
prependCWRe: prependCWRe,
});
ensureComposeIsVisible(getState, routerHistory);

View File

@ -166,6 +166,14 @@ class LocalSettingsPage extends React.PureComponent {
>
<FormattedMessage id='settings.always_show_spoilers_field' defaultMessage='Always enable the Content Warning field' />
</LocalSettingsPageItem>
<LocalSettingsPageItem
settings={settings}
item={['prepend_cw_re']}
id='mastodon-settings--prepend_cw_re'
onChange={onChange}
>
<FormattedMessage id='settings.prepend_cw_re' defaultMessage='Prepend “re: ” to content warnings when replying' />
</LocalSettingsPageItem>
<LocalSettingsPageItem
settings={settings}
item={['preselect_on_reply']}

View File

@ -387,7 +387,7 @@ export default function compose(state = initialState, action) {
if (action.status.get('spoiler_text').length > 0) {
let spoiler_text = action.status.get('spoiler_text');
if (!spoiler_text.match(/^re[: ]/i)) {
if (action.prependCWRe && !spoiler_text.match(/^re[: ]/i)) {
spoiler_text = 're: '.concat(spoiler_text);
}
map.set('spoiler', true);

View File

@ -17,6 +17,7 @@ const initialState = ImmutableMap({
confirm_missing_media_description: false,
confirm_boost_missing_media_description: false,
confirm_before_clearing_draft: true,
prepend_cw_re: true,
preselect_on_reply: true,
inline_preview_cards: true,
hicolor_privacy_icons: false,