]> cat aescling's git repositories - mastodon.git/commitdiff
Make prepending “re: ” to CWs on reply optional
authorThibaut Girka <thib@sitedethib.com>
Tue, 7 Jan 2020 17:11:50 +0000 (18:11 +0100)
committerThibG <thib@sitedethib.com>
Tue, 7 Jan 2020 18:05:31 +0000 (19:05 +0100)
app/javascript/flavours/glitch/actions/compose.js
app/javascript/flavours/glitch/features/local_settings/page/index.js
app/javascript/flavours/glitch/reducers/compose.js
app/javascript/flavours/glitch/reducers/local_settings.js

index f80642bd8341648be02e86ac5d9cf18d0b273087..0be74604895b46909b4866c0a86dc31bce8b5152 100644 (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);
index e08c12c765eec8ea24ee3d57b446441d263216ac..0b34280275855ecf272239fc344ebaf7e9377e52 100644 (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']}
index 0f807790bd3d3b6ecfacbd792897f9ba518f6be2..92a9859d950c6a4877f3eb6d126c9f90d8f3781c 100644 (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);
index ad94ea2433fa35cc23a499feb53f91ab086ced21..3d94d665c2264d8386ea46aec0e2f8322015f762 100644 (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,