Skip to content

Commit

Permalink
When sending a toot, ensure a CW is only set if the CW field is visib…
Browse files Browse the repository at this point in the history
…le (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.
  • Loading branch information
ClearlyClaire authored and Gargron committed Jun 29, 2019
1 parent d8f967e commit b986d34
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/javascript/mastodon/actions/compose.js
Original file line number Diff line number Diff line change
Expand Up @@ -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),
}, {
Expand Down
1 change: 1 addition & 0 deletions app/javascript/mastodon/reducers/compose.js
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down

0 comments on commit b986d34

Please sign in to comment.