phanpy icon indicating copy to clipboard operation
phanpy copied to clipboard

Phanpy discards Content Warning when replying to Private Mentions

Open fl4nn opened this issue 9 months ago • 1 comments

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

  1. Receive a Private Mention with CW
  2. Reply
  3. 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

fl4nn avatar Apr 04 '25 12:04 fl4nn

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.

fl4nn avatar Apr 04 '25 14:04 fl4nn

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...

VirtualWolf avatar Jun 08 '25 01:06 VirtualWolf

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. 😄

VirtualWolf avatar Jun 08 '25 08:06 VirtualWolf

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

  1. Post a text-only toot from Phanpy with a content warning.
  2. Look at that toot directly via the Mastodon API and see that the spoiler_text field is filled out and that the sensitive field is set to true.
  3. Reply to that CWed toot from the Android client Tusky specifically.
  4. Look at that reply from Tusky directly via the API and see that while the spoiler_text field is still intact, the sensitive field has been set back to false.
  5. 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.

VirtualWolf avatar Aug 05 '25 11:08 VirtualWolf