Skip to content

Keep content warning when editing a post - #1584

Open
thribhuvan003 wants to merge 2 commits into
cheeaun:mainfrom
thribhuvan003:fix/keep-cw-when-editing
Open

Keep content warning when editing a post#1584
thribhuvan003 wants to merge 2 commits into
cheeaun:mainfrom
thribhuvan003:fix/keep-cw-when-editing

Conversation

@thribhuvan003

Copy link
Copy Markdown

Fixes #1424.

Editing a post that has a content warning publishes it without the CW. The reporter noted this can leave a sensitive post up uncovered.

When the editor loads a post it sets sensitive from the post's own flag:

setSensitive(sensitive);

but on submit the CW is only sent when sensitive is true:

spoilerText = (sensitive && spoilerText) || undefined;

spoiler_text and sensitive are independent, so a post can carry a CW with sensitive: false. #1236 already fixed this for replies, and its description spells out when it happens: clients like Tusky "set the sensitive flag back to false on replies with CWs when there isn't media attached". The reply path was changed then, the edit path still uses the old logic.

This mirrors that fix, keeping sensitive in the condition so a post with sensitive media but no CW is unaffected:

setSensitive(sensitive || !!spoilerText);

Testing

Existing Playwright suite on Mobile Safari: 62 passed, 1 failed. The failure is date-time-format.spec.js:176 (en-SG locale combination), which fails the same way on main without this change.

I couldn't add a test for this one. Reaching the edit composer needs an authenticated session, and #1236 was merged as a one-line change to the same function without a test, so I kept it consistent with that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Content warning gets removed when editing post

1 participant