Skip to content

Migrate the message reaction lists to the generated ReactionResponse model - #6682

Draft
gpunto wants to merge 1 commit into
developfrom
migrate/message-reaction-lists
Draft

Migrate the message reaction lists to the generated ReactionResponse model#6682
gpunto wants to merge 1 commit into
developfrom
migrate/message-reaction-lists

Conversation

@gpunto

@gpunto gpunto commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Goal

Parse a message's latest_reactions and own_reactions with the generated ReactionResponse.

Part of AND-1291

Implementation

  • Point both reaction lists at ReactionResponse and replace the DTO list mapper with toReactions(messageId). The name differs because JVM erasure would clash with the DownstreamReactionDto overload. ReactionResponse.toDomain() already exists, so no per-reaction mapping is added, and the @StreamHandsOff recording why the list is filtered by message id carries over.
  • Give the reaction fixtures the fields the generated model needs: both timestamps on the reaction, and created_at, updated_at and language on its user.
  • Give the event fixture's reaction its own nested user. The shared createUserJsonString is an own-user shape carrying unread counts, devices, mutes and invisible, none of which the wire sends for a reaction's user, and through the generated model they either vanish or land in custom.

DownstreamReactionDto stays for the reaction events, which still parse it.

Notes

The generated model requires both timestamps and a non-null user where the DTO allowed them absent. payload.ReactionResponse declares User as a value type with a plain tag and both timestamps without omitempty, and MessageResponse.LatestReactions/OwnReactions are that same struct, so an embedded reaction always carries them.

Testing

  • Device probe: sent a message, reacted with a score, an emoji code and custom data, then read it back through getMessage and queryChannels. Every reaction in both lists mapped fully, each nested user carried the three required fields, and the emoji and custom values round-tripped while emoji_code stayed out of extraData.
  • Mutation sweep over ReactionResponse.toDomain: all 9 mapped fields are caught by a test.
  • Dropping the per-message filter, or swapping the two lists, each fail tests.

latest_reactions comes back empty from a channel query because only some endpoints add EnrichLatestReactions server-side, while own_reactions is populated. That is unchanged by this PR: the field arrives as JSON null either way and is coerced to an empty list.

@gpunto gpunto added the pr:internal Internal changes / housekeeping label Sep 4, 2026
@github-actions

github-actions Bot commented Sep 4, 2026

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

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

SDK Size Comparison 📏

SDK Before After Difference Status
stream-chat-android-client 6.11 MB 6.11 MB 0.00 MB 🟢
stream-chat-android-ui-components 11.41 MB 11.41 MB 0.00 MB 🟢
stream-chat-android-compose 12.90 MB 12.90 MB 0.00 MB 🟢

@sonarqubecloud

sonarqubecloud Bot commented Sep 4, 2026

Copy link
Copy Markdown

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

Labels

pr:internal Internal changes / housekeeping

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant