Repository navigation
Conversation
…HTML
The push text was the stored body with its whitespace collapsed, so a phone
showed what the page reads: [[reply:…]], [[files:…]], [[code:…]] and
[[pin:…]] markers, and the rich composer's HTML (<a href=…>, ). Now
the markers are left out, the HTML becomes the text a reader sees, and a
message that was only a marker says what it did ("pinned a message",
"sent code", "shared files"). A marker's payload can't hold a bracket, so a
body full of unclosed "[[" is still matched in linear time.
notifyPerson runs inside the message's transaction and never throws, so if
the text can't be made from a body, the notification goes out without text
and the DM is still sent.
This was referenced Nov 26, 2026
Contributor
Author
|
Combined into #314 with the same commits. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A DM's phone notification (added in #277) now shows the message's words. Before, it showed the message the way Spring stores it, so a reply came through as
[[reply:9|Bob|hey%20there]] thanks!instead ofthanks!, and a pasted link came through as<a href=…>HTML.PushNotificationService.snippetbuilds the notification's text from the message body. Before, it only collapsed whitespace and cut the body to 140 characters. It still cuts to 140, now after the cleanup./dm) puts[[…]]markers in a message's text for things like replies, code blocks and pins. The page reads them and shows a quote, a code block or a pin note instead, so a person never sees the marker itself.snippetnow takes those markers out and keeps the words around them.snippetturns it into plain text with jsoup, the HTML parser Spring already uses for DM search: tags come out,&becomes&, and becomes a space.Other notes:
ANY_MARKER_PATTERNin pages'assets/js/chat/chat-reply.js, includingcodefrom Messages: GitHub link cards, slash commands and code blocks pages#2071 andpinandunpinfrom Messages: a Shared panel and pins pages#2072. I left a comment next to Spring's list saying it has to match, so a new marker gets added in both.[out too. That way a message full of[[that never close doesn't slowsnippetdown.notifyPersonruns inside the DM's transaction and never throws, so if the text can't be made from a body, it logs a warning and the notification goes out without text. The DM is still sent.PushNotificationSnippetTest(5 tests, 3 of them fail on master). The full suite passes exceptImportPersonPasswordTest(it needs a local.env) andPersonCapstoneApprovalRouteTest, which fail the same way on master.How to try it: run
./mvnw test -Dtest='PushNotification*Test'. That runs the new test and the two push notification tests that were already there.