Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not display spoilers in message previews #13

Merged
merged 3 commits into from
Apr 5, 2023

Conversation

cloudrac3r
Copy link

"Message previews" means notifications and the room list preview. If there are more spots where message previews appear I can extend this function to cover those as well.

I can't test these changes properly right now because I forgot how to get a working build of SchildiChat. However, I tested this in the past and it worked perfectly! Hopefully it still works now that I've cherry-picked it 6 months into the future.

I want to get this into Element as well if it works well in Schildi.

As usual, thanks for everything!

  • I agree to release my changes under this project's license

@cloudrac3r
Copy link
Author

I seem to remember that removing the getHtmlText is fine and safe but it's been so long since I initially wrote this code that I forgot the reason. Sorry!

@cloudrac3r
Copy link
Author

I seem to remember that removing the getHtmlText is fine and safe but it's been so long since I initially wrote this code that I forgot the reason. Sorry!

The DOMParser doesn't execute styles or scripts, it's just a parser. And since only textContent leaves, which is a string displayed as a string, there's no risk of XSS or whatever. So there's no problem in removing the getHtmlText call because there's no security risk.

@su-ex
Copy link
Member

su-ex commented Jan 15, 2023

Multi language should be taken care of.
And it's still called "fallback" though it's not, so should probably be renamed. xD

@su-ex
Copy link
Member

su-ex commented Mar 15, 2023

Bump! 🪨

@cloudrac3r
Copy link
Author

Sorry, I don't know if/when I'll get the chance to make the changes you requested!

That said, the actual spoiler hiding functionality continues to work well. One flaw is that (as far as I can tell??) if the function returns null it would display null in the sidebar. This seems to happen very rarely in practice (less frequently than once a week on my main account).

@cloudrac3r
Copy link
Author

Also noting that this works well with messages where the body and formatted_body text is different: a message with body like \*waves\* and formatted_body like *waves* will now display as *waves* with this patch.

Will briefly look into localisation now.

* Modify room list previewer to remove spoilers
* Also use room list previewer for notification text
@cloudrac3r
Copy link
Author

OK, updated and rebased with latest sc branch. Manual checks pass (I tested regular messages, /me, spoilers, partial spoilers, in both notification and room list preview). The null issue I mentioned earlier is now also fixed. [spoiler] has been added to the en_EN.json file. This is good for merge if you don't have any other concerns.

@su-ex
Copy link
Member

su-ex commented Apr 5, 2023

Ah cool, now those errors are gone.
Let's just go with it and see what happens. 🚀

@su-ex su-ex merged commit def6646 into SchildiChat:sc Apr 5, 2023
SpiritCroc pushed a commit that referenced this pull request Oct 6, 2024
* Copyright headers 1

* Licence headers 2

* Copyright Headers 3

* Copyright Headers 4

* Copyright Headers 5

* Copyright Headers 6

* Copyright headers 7

* Add copyright headers for html and config file

* Replace license files and update package.json

* Update with CLA

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

3 participants