Phanpy discards Content Warning when replying to Private Mentions
Site
phanpy.squirrel.rocks
Version
2025.03.22.85d964f
Instance
boosts.squirrel.pictures
Browser
Firefox 136.0.4 on openSUSE Tumbleweed
Bug description
When replying to a Private Mention that has a CW Phanpy defaults to CW disabled in the compose window, which means the reply would be sent without CW / the existing CW is discarded unless manually enabling CW again before sending.
To reproduce
- Receive a Private Mention with CW
- Reply
- In the Compose Window, note that the CW field is not displayed, the CW button shows CW disabled
Expected behavior
The CW is kept intact by default.
Other
No response
It appears there's another condition for this to happen: CW without Media Attachment
If the Private Mention has a CW and Media Attachment the CW is kept as expected.
If the Private Mention has a CW but no Media Attachment the CW is discarded in the reply window.
FWIW I've noticed this a few times just with regular toots (not private mentions), but I haven't been able to pin down the exact circumstances in which it occurs yet...
Okay so I did some poking around with the codebase locally and it seems to be caused by this line inside the useEffect hook when replying to a toot:
setSensitive(sensitive && !!spoilerText);
If I change that line to be this...
setSensitive(sensitive || spoilerText);
...the compose box keeps the CW as expected.
That original functionality was added back in 2023 and I can see the logic behind it, but I guess somewhere along the line after that something has changed and the sensitive attribute is being used for a bit more now?
@cheeaun I'm happy to raise the world's simplest PR for the change I described above, but I don't know if there is more background I'm missing. 😄
PHEW! So with the help of an Android-using friend, I've been able to actually replicate this and understand why it's happening, at least in the specific scenario I describe here.
Steps to reproduce
- Post a text-only toot from Phanpy with a content warning.
- Look at that toot directly via the Mastodon API and see that the
spoiler_textfield is filled out and that thesensitivefield is set totrue. - Reply to that CWed toot from the Android client Tusky specifically.
- Look at that reply from Tusky directly via the API and see that while the
spoiler_textfield is still intact, thesensitivefield has been set back tofalse. - Go to compose a reply to that Tusky-originating toot in Phanpy and the "Content warning" field is no longer being pre-filled.
Because of this behaviour from Tusky combined with the way Phanpy determines whether to pre-fill the content warning field based on requiring the sensitive field in the toot you're replying to being set to true, you end up with the behaviour we're seeing here where the content warning goes missing.
I did some other testing as well, and if the sensitive field is set to true and the spoiler_text field is just an empty string, the existing behaviour where the text of the toot is visible but the media itself is hidden behind a blur that you need to click on to reveal is preserved. So I think it's fine to have the change I suggested above where the content warning field in Phanpy is pre-filled if the toot is marked as sensitive or there's spoiler text, rather than requiring the sensitive flag but also no content warning.