fix(chat): keep unknown system messages from rendering as chat bubbles - #6594
Merged
Conversation
DUMMY is the marker for "not a system message", so mapping an unrecognised systemMessage identifier to it made getCalculateMessageType() classify the message as REGULAR_TEXT_MESSAGE. The server text then rendered in a chat bubble with avatar and actor name instead of as centered grey text, and every system message identifier added by a newer server regressed the same way. Reserve DUMMY for what the server means by it, an empty systemMessage, and map any other unrecognised identifier to the new UNKNOWN type. Future server-side additions now render correctly without an app change, since their text comes from the server anyway. Add the three identifiers the client was missing: preserve_conversation, preserve_conversation_off and phone_removed. convertToString() had the same defect on the conversation list last-message path, which serialises ChatMessageJson into the conversation entity: CLEARED_CHAT was written as "clear_history" while parsing expects "history_cleared", and THREAD_RENAMED had no branch at all, so both came back as DUMMY. UNKNOWN serialises to a sentinel that parses back to UNKNOWN so it survives that round trip too. getFromString() now takes String?, which is what LoganSquare passes for a null JSON value. The new test asserts every enum member survives a convertToString -> getFromString round trip, which is what would have caught the "clear_history" typo. Assisted-by: Claude Code:claude-opus-5 Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
mahibi
approved these changes
Aug 27, 2026
Contributor
|
APK file: https://github.com/nextcloud/talk-android/actions/runs/33057039930/artifacts/9641123126 |
AndyScherzinger
marked this pull request as ready for review
August 27, 2026 16:19
Member
Author
|
/backport to stable-25.0.x |
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.
DUMMY is the marker for "not a system message", so mapping an unrecognised systemMessage identifier to it made getCalculateMessageType() classify the message as REGULAR_TEXT_MESSAGE. The server text then rendered in a chat bubble with avatar and actor name instead of as centered grey text, and every system message identifier added by a newer server regressed the same way.
Reserve DUMMY for what the server means by it, an empty systemMessage, and map any other unrecognised identifier to the new UNKNOWN type. Future server-side additions now render correctly without an app change, since their text comes from the server anyway.
Add the three identifiers the client was missing: preserve_conversation, preserve_conversation_off and phone_removed.
convertToString() had the same defect on the conversation list last-message path, which serialises ChatMessageJson into the conversation entity: CLEARED_CHAT was written as "clear_history" while parsing expects "history_cleared", and THREAD_RENAMED had no branch at all, so both came back as DUMMY. UNKNOWN serialises to a sentinel that parses back to UNKNOWN so it survives that round trip too.
getFromString() now takes String?, which is what LoganSquare passes for a null JSON value.
The new test asserts every enum member survives a convertToString -> getFromString round trip, which is what would have caught the "clear_history" typo.
Assisted-by: Claude Code:claude-opus-5
🖼️ Screenshots
🚧 TODO
🏁 Checklist
/backport to stable-xx.x🤖 AI (if applicable)