]> cat aescling's git repositories - mastodon.git/commitdiff
When sending a toot, ensure a CW is only set if the CW field is visible (#11206)
authorThibG <thib@sitedethib.com>
Sat, 29 Jun 2019 16:32:36 +0000 (18:32 +0200)
committerEugen Rochko <eugen@zeonfederated.com>
Sat, 29 Jun 2019 16:32:36 +0000 (18:32 +0200)
In some occasions, such as the browser or a browser extension auto-filling
the existing but disabled/hidden CW field, a CW can be set without the user
knowing.

app/javascript/mastodon/actions/compose.js
app/javascript/mastodon/reducers/compose.js

index 300fb48a99f417e93666b77081ba29eeef0696ab..fbf97d37475036232741bb3d2496aab2d04c715b 100644 (file)
@@ -139,7 +139,7 @@ export function submitCompose(routerHistory) {
       in_reply_to_id: getState().getIn(['compose', 'in_reply_to'], null),
       media_ids: media.map(item => item.get('id')),
       sensitive: getState().getIn(['compose', 'sensitive']),
-      spoiler_text: getState().getIn(['compose', 'spoiler_text'], ''),
+      spoiler_text: getState().getIn(['compose', 'spoiler']) ? getState().getIn(['compose', 'spoiler_text'], '') : '',
       visibility: getState().getIn(['compose', 'privacy']),
       poll: getState().getIn(['compose', 'poll'], null),
     }, {
index 29c69114403d55743a48e17ae25279f95a4ddff2..8cdd29bfeb3b5a7689a8187e0fa53507e136cfd6 100644 (file)
@@ -224,6 +224,7 @@ export default function compose(state = initialState, action) {
       }
     });
   case COMPOSE_SPOILER_TEXT_CHANGE:
+    if (!state.get('spoiler')) return state;
     return state
       .set('spoiler_text', action.text)
       .set('idempotencyKey', uuid());