Skip to content

Fix unable to update delivery receipts privacy setting#6178

Merged
VelikovPetar merged 1 commit intodevelopfrom
bug/AND-1078_fix_unable_to_update_delivery_recipts
Feb 23, 2026
Merged

Fix unable to update delivery receipts privacy setting#6178
VelikovPetar merged 1 commit intodevelopfrom
bug/AND-1078_fix_unable_to_update_delivery_recipts

Conversation

@VelikovPetar
Copy link
Contributor

@VelikovPetar VelikovPetar commented Feb 21, 2026

Goal

Fix the issue where delivery receipts privacy setting was not being sent to the backend when users attempted to update their privacy settings (AND-1078).

Implementation

  • Added missing delivery_receipts field mapping in PrivacySettings.toDto() in DtoMapping.kt
  • Added DeliveryReceipts.toDto() extension function to convert domain model to DTO
  • Added delivery_receipts serialization in SocketFactory.reducePrivacySettings() for WebSocket connection
  • Added comprehensive unit tests for the new mappings

🎨 UI Changes

No UI changes.

Testing

  • Unit tests added in DtoMappingTest.kt and SocketFactoryTest.kt
  • Manually verify by setting delivery receipts privacy setting and confirming it persists after reconnection

Summary by CodeRabbit

  • New Features

    • Delivery receipts are now fully integrated into privacy settings, allowing users to configure delivery receipt tracking and visibility preferences alongside other privacy controls for comprehensive privacy management.
  • Tests

    • Comprehensive testing implemented to validate delivery receipts configuration within privacy settings, covering both populated and empty configuration scenarios.

@VelikovPetar VelikovPetar added the pr:bug Bug fix label Feb 21, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Feb 21, 2026

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.

🎉 Great job! This PR is ready for review.

@github-actions
Copy link
Contributor

SDK Size Comparison 📏

SDK Before After Difference Status
stream-chat-android-client 5.26 MB 5.26 MB 0.00 MB 🟢
stream-chat-android-offline 5.48 MB 5.48 MB 0.00 MB 🟢
stream-chat-android-ui-components 10.63 MB 10.63 MB 0.00 MB 🟢
stream-chat-android-compose 12.85 MB 12.85 MB 0.00 MB 🟢

@sonarqubecloud
Copy link

@VelikovPetar VelikovPetar marked this pull request as ready for review February 23, 2026 08:01
@VelikovPetar VelikovPetar requested a review from a team as a code owner February 23, 2026 08:01
@coderabbitai
Copy link

coderabbitai bot commented Feb 23, 2026

Walkthrough

This pull request adds support for delivery receipts within privacy settings across the Stream Chat Android client. Changes include introducing DTO mapping for DeliveryReceipts, updating PrivacySettings.toDto() to include delivery_receipts, modifying SocketFactory's privacy settings reduction logic to handle the new property, and extending test coverage to validate the new mappings and socket factory behavior.

Changes

Cohort / File(s) Summary
DTO Mapping Implementation
stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/mapping/DtoMapping.kt
Adds internal extension function DeliveryReceipts.toDto(): DeliveryReceiptsDto and imports. Updates PrivacySettings.toDto() to populate delivery_receipts using the new mapping when present.
Socket Factory Updates
stream-chat-android-client/src/main/java/io/getstream/chat/android/client/socket/SocketFactory.kt
Refactors PrivacySettings.reducePrivacySettings() to use .let for typing_indicators and introduces delivery_receipts handling alongside existing read_receipts property reduction.
Test Coverage
stream-chat-android-client/src/test/java/io/getstream/chat/android/client/api2/mapping/DtoMappingTest.kt, stream-chat-android-client/src/test/java/io/getstream/chat/android/client/socket/SocketFactoryTest.kt
Extends PrivacySettings toDto mapping tests to cover non-null and null deliveryReceipts scenarios. Adds test imports, new test data arguments with privacy settings configurations, and refactors test JSON construction to conditionally include privacy_settings object with typing_indicators, delivery_receipts, and read_receipts.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 Hoppy times! Delivery's here to stay,
Receipts now wrapped in privacy's way,
Mapping flows and tests aligned,
The chat receives what it's designed! 📨✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 30.00% 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 specifically summarizes the main change: fixing the delivery receipts privacy setting update issue.
Description check ✅ Passed The description includes Goal, Implementation, and Testing sections covering the bug fix, but lacks UI Changes details and contributor checklist completion.

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

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch bug/AND-1078_fix_unable_to_update_delivery_recipts

Tip

Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord.


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.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
stream-chat-android-client/src/test/java/io/getstream/chat/android/client/socket/SocketFactoryTest.kt (1)

145-176: Both new privacy-settings cases only cover expireToken = false.

The existing test matrix already crosses each user shape with both token states (lines 103–130 include expireToken = true cases). The new cases with privacy settings are only exercised with expireToken = false, leaving the loadSyncToken path untested for these shapes. Consider adding a expireToken = true variant for at least one of the new scenarios to keep coverage consistent.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@stream-chat-android-client/src/test/java/io/getstream/chat/android/client/socket/SocketFactoryTest.kt`
around lines 145 - 176, The new privacy-settings test cases only exercise
expireToken = false; add at least one duplicate case (using the same randomUser
shape or one of the two privacy-settings variants) with expireToken = true so
the loadSyncToken branch is exercised; specifically, duplicate one of the
Arguments.of entries that builds
SocketFactory.ConnectionConf.UserConnectionConf(...) (the case using
buildFullUserJson(it, it.id) and headersUtil.buildSdkTrackingHeaders()) but set
the first argument to true to cover the expireToken=true path.
ℹ️ Review info

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 38f908a and 86b2752.

📒 Files selected for processing (4)
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/mapping/DtoMapping.kt
  • stream-chat-android-client/src/main/java/io/getstream/chat/android/client/socket/SocketFactory.kt
  • stream-chat-android-client/src/test/java/io/getstream/chat/android/client/api2/mapping/DtoMappingTest.kt
  • stream-chat-android-client/src/test/java/io/getstream/chat/android/client/socket/SocketFactoryTest.kt
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@stream-chat-android-client/src/test/java/io/getstream/chat/android/client/socket/SocketFactoryTest.kt`:
- Line 101: Add a short KDoc or inline comment immediately above the
`@Suppress`("MaxLineLength", "LongMethod") annotation in SocketFactoryTest (the
suppression on the test method/class) that documents why the LongMethod
suppression is necessary (e.g., the test aggregates many scenarios, readability
trade-off, references to a tracking issue or ticket if applicable), states the
scope (which method/class it applies to), and how/when it should be revisited;
keep the comment concise and specific so the suppression is justified per coding
guidelines.

---

Nitpick comments:
In
`@stream-chat-android-client/src/test/java/io/getstream/chat/android/client/socket/SocketFactoryTest.kt`:
- Around line 145-176: The new privacy-settings test cases only exercise
expireToken = false; add at least one duplicate case (using the same randomUser
shape or one of the two privacy-settings variants) with expireToken = true so
the loadSyncToken branch is exercised; specifically, duplicate one of the
Arguments.of entries that builds
SocketFactory.ConnectionConf.UserConnectionConf(...) (the case using
buildFullUserJson(it, it.id) and headersUtil.buildSdkTrackingHeaders()) but set
the first argument to true to cover the expireToken=true path.

@VelikovPetar VelikovPetar merged commit d7a52d6 into develop Feb 23, 2026
22 of 23 checks passed
@VelikovPetar VelikovPetar deleted the bug/AND-1078_fix_unable_to_update_delivery_recipts branch February 23, 2026 08:46
@stream-public-bot stream-public-bot added the released Included in a release label Feb 24, 2026
@stream-public-bot
Copy link
Contributor

🚀 Available in v6.32.4

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