Skip to content

Comments

Fix markDelivered not working when switching users#6093

Merged
andremion merged 3 commits intodevelopfrom
bug/AND-1029_fix_mark_delivered_when_switching_users
Jan 22, 2026
Merged

Fix markDelivered not working when switching users#6093
andremion merged 3 commits intodevelopfrom
bug/AND-1029_fix_mark_delivered_when_switching_users

Conversation

@VelikovPetar
Copy link
Contributor

@VelikovPetar VelikovPetar commented Jan 22, 2026

🎯 Goal

The MessageReceiptManager keeps a lazy reference to the RepositoryFacade. The facade is switched with a new instance if the connected User changes, but the MessageReceiptManager is not.
So if the connected User changes, the MessageReceiptManager by keeping a lazy reference to the (old) RepositoryFacade attempts to read outdated data (from the previously connected User).

🛠 Implementation details

  • Remove the lazy persistence of the RepositoryFacade from the MessageReceiptManager

🎨 UI Changes

NA

🧪 Testing

  1. Log in, log out, and log in with a different user
  2. Check the logs for Chat:MessageReceiptManager
  3. There should be no WARNING logs with text: [markChannelsAsDelivered] Current user not found

Summary by CodeRabbit

  • Bug Fixes
    • Fixed an issue where the markDelivered operation would not function correctly when switching between users.

✏️ Tip: You can customize this high-level summary in your review settings.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 22, 2026

SDK Size Comparison 📏

SDK Before After Difference Status
stream-chat-android-client 5.25 MB 5.25 MB 0.00 MB 🟢
stream-chat-android-offline 5.48 MB 5.48 MB 0.00 MB 🟢
stream-chat-android-ui-components 10.62 MB 10.62 MB 0.00 MB 🟢
stream-chat-android-compose 12.84 MB 12.84 MB 0.00 MB 🟢

@VelikovPetar VelikovPetar marked this pull request as ready for review January 22, 2026 12:34
@VelikovPetar VelikovPetar requested a review from a team as a code owner January 22, 2026 12:34
@coderabbitai
Copy link

coderabbitai bot commented Jan 22, 2026

Walkthrough

A refactoring that renames the MessageReceiptManager constructor parameter from getRepositoryFacade to repositoryFacade and removes lazy initialization. Updates are propagated through ChatClient initialization, internal method calls, and tests. A changelog entry documents that markDelivered now works when switching users.

Changes

Cohort / File(s) Summary
Documentation
CHANGELOG.md
Added changelog entry documenting markDelivered operation now works when switching users.
Core Implementation
stream-chat-android-client/src/main/java/io/getstream/chat/android/client/ChatClient.kt, stream-chat-android-client/src/main/java/io/getstream/chat/android/client/receipts/MessageReceiptManager.kt
Renamed constructor parameter getRepositoryFacade to repositoryFacade in MessageReceiptManager. Removed lazy initialization wrapper; updated all internal call sites to invoke the function via repositoryFacade(). Updated Javadoc accordingly.
Tests
stream-chat-android-client/src/test/java/io/getstream/chat/android/client/receipts/MessageReceiptManagerTest.kt
Updated test fixture to use new constructor parameter name repositoryFacade.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested reviewers

  • gpunto

Poem

🐰 A parameter rename, clean and bright,
getRepositoryFacade takes flight,
Now repositoryFacade stands tall,
No lazy tricks, just direct calls,
When users switch, marked delivered's right! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 16.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: fixing markDelivered functionality when users switch.
Description check ✅ Passed The description covers the goal, implementation details, and testing instructions, but is missing sections like UI Changes detail (shows NA), contributor checklist, and reviewer checklist.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

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

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

@sonarqubecloud
Copy link

@andremion andremion enabled auto-merge (squash) January 22, 2026 15:34
@andremion andremion disabled auto-merge January 22, 2026 15:34
@andremion andremion enabled auto-merge (squash) January 22, 2026 15:34
@andremion andremion merged commit 7f332c6 into develop Jan 22, 2026
19 of 20 checks passed
@andremion andremion deleted the bug/AND-1029_fix_mark_delivered_when_switching_users branch January 22, 2026 15:34
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