Skip to content

Keep the thread parent's quoted message when a reply is sent - #6730

Merged
gpunto merged 1 commit into
developfrom
fix/thread-parent-keeps-quoted-message
Sep 25, 2026
Merged

gpunto merged 1 commit into
developfrom
fix/thread-parent-keeps-quoted-message

Conversation

@gpunto

@gpunto gpunto commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Goal

When a thread's parent message quotes another message, sending a reply in the thread removes the quote preview from the
parent. It comes back when the thread is reopened.

Closes AND-1553

Implementation

  • A reply makes the backend send message.updated for the parent, with its quoted_message. ThreadLogic looked the
    quoted message up only among the thread's messages, which usually don't include it, so the parent lost it.
  • It now falls back to the quoted message in the event, as the channel event handler already does. A copy held in the
    thread still takes precedence.

Testing

ThreadLogicTest covers a quote from outside the thread, which the event now keeps, and a quote from inside the thread,
where the thread's copy is used.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Updated messages now retain their quoted reply when the quoted message isn’t in the thread. If it is in the thread, the thread’s version is used.

@gpunto gpunto added the pr:bug Bug fix label Sep 24, 2026
@github-actions

Copy link
Copy Markdown
Contributor

PR checklist ✅

All required conditions are satisfied:

  • Title length is OK (or ignored by label).
  • At least one pr: label exists.
  • Sections ### Goal, ### Implementation, and ### Testing are filled, or the PR is bot-authored.
  • An issue is linked (Linear ticket or GitHub issue), or the PR is bot-authored.

🎉 Great job! This PR is ready for review.

@github-actions

Copy link
Copy Markdown
Contributor

SDK Size Comparison 📏

SDK Before After Difference Status
stream-chat-android-client 6.09 MB 6.09 MB 0.00 MB 🟢
stream-chat-android-ui-components 11.40 MB 11.40 MB 0.00 MB 🟢
stream-chat-android-compose 13.07 MB 13.07 MB 0.00 MB 🟢

@sonarqubecloud

Copy link
Copy Markdown

@gpunto
gpunto marked this pull request as ready for review September 25, 2026 06:47
@gpunto
gpunto requested a review from a team as a code owner September 25, 2026 06:47
@gpunto
gpunto enabled auto-merge September 25, 2026 06:48
@coderabbitai

coderabbitai Bot commented Sep 25, 2026

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 3f90771f-4ac4-49f2-b99e-edacfade2552

📥 Commits

Reviewing files that changed from the base of the PR and between e590dda and fffaaa3.

📒 Files selected for processing (2)
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/client/internal/state/plugin/logic/channel/thread/internal/ThreadLogic.kt
  • stream-chat-android-client/src/test/java/io/getstream/chat/android/client/internal/state/plugin/logic/channel/thread/internal/ThreadLogicTest.kt

Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review.


Walkthrough

When a thread message update references a quoted message outside the thread, the update now retains the event’s existing replyTo. Tests cover both outside-thread and in-thread quoted messages.

Changes

Thread reply handling

Layer / File(s) Summary
Quoted reply selection
stream-chat-android-client/src/main/java/io/getstream/chat/android/client/internal/state/plugin/logic/channel/thread/internal/ThreadLogic.kt, stream-chat-android-client/src/test/java/io/getstream/chat/android/client/internal/state/plugin/logic/channel/thread/internal/ThreadLogicTest.kt
When the quoted message is absent from the thread, the update retains the event’s replyTo. Tests verify that fallback and that a matching thread message is used when present.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: andremion

Merge Risk: ⚪ Minimal · up to fffaa

The change is ready to merge after normal checks: it retains the parent’s quoted-message preview when the quote is outside the thread while preferring the thread’s copy when present.

Security Architecture Review

Security architecture risk: 🔵 Low · up to fffaa

The change is limited to how the client preserves an existing quote preview. No new message-fetching path or access-control bypass was established, although upstream event validation and some update-ordering behavior remain unverified.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The changed quote-selection path is confined to client thread state; the supplied impact map establishes no changed dependency edge. It does not establish how the server authorizes the embedded quote.

Trust Boundaries and Controls

  • observed — A matching thread-local quoted message wins over the event payload. If none matches, this handler accepts the event’s embedded quote without a local quote-identity check.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: preserving the thread parent’s quoted message when a reply is sent.
Description check ✅ Passed The description includes the goal, implementation details, linked issue, and testing information. The omitted UI and checklist details are not critical for this non-UI bug fix.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

A quoted reply stays near,
Even when its thread is clear.
If the thread has the message in view,
Its matching reply is used too.
A rabbit checks the thread with care.

Comment @coderabbitai help to get the list of available commands.

@gpunto
gpunto added this pull request to the merge queue Sep 25, 2026
Merged via the queue into develop with commit 430a231 Sep 25, 2026
20 of 21 checks passed
@gpunto
gpunto deleted the fix/thread-parent-keeps-quoted-message branch September 25, 2026 10:56
@stream-public-bot stream-public-bot added the released Included in a release label Sep 30, 2026
@stream-public-bot

Copy link
Copy Markdown
Contributor

🚀 Available in v7.13.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr:bug Bug fix released Included in a release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants