Skip to content

Commit b986d34

Browse files
ClearlyClaireGargron
authored andcommitted
When sending a toot, ensure a CW is only set if the CW field is visible (mastodon#11206)
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.
1 parent d8f967e commit b986d34

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

app/javascript/mastodon/actions/compose.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ export function submitCompose(routerHistory) {
139139
in_reply_to_id: getState().getIn(['compose', 'in_reply_to'], null),
140140
media_ids: media.map(item => item.get('id')),
141141
sensitive: getState().getIn(['compose', 'sensitive']),
142-
spoiler_text: getState().getIn(['compose', 'spoiler_text'], ''),
142+
spoiler_text: getState().getIn(['compose', 'spoiler']) ? getState().getIn(['compose', 'spoiler_text'], '') : '',
143143
visibility: getState().getIn(['compose', 'privacy']),
144144
poll: getState().getIn(['compose', 'poll'], null),
145145
}, {

app/javascript/mastodon/reducers/compose.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ export default function compose(state = initialState, action) {
224224
}
225225
});
226226
case COMPOSE_SPOILER_TEXT_CHANGE:
227+
if (!state.get('spoiler')) return state;
227228
return state
228229
.set('spoiler_text', action.text)
229230
.set('idempotencyKey', uuid());

0 commit comments

Comments
 (0)