Skip to content

Fix delete message not working when offline (SYNC_NEEDED)#6184

Merged
VelikovPetar merged 2 commits into
developfrom
bug/fix_delete_message_offline_not_working
Feb 24, 2026
Merged

Fix delete message not working when offline (SYNC_NEEDED)#6184
VelikovPetar merged 2 commits into
developfrom
bug/fix_delete_message_offline_not_working

Conversation

@VelikovPetar
Copy link
Copy Markdown
Contributor

@VelikovPetar VelikovPetar commented Feb 24, 2026

Goal

Messages with SYNC_NEEDED sync status (i.e., messages that were sent while offline and are pending sync) were incorrectly treated as local-only when a delete was requested. This caused the delete API to be skipped, leaving the message undeleted on the server once connectivity was restored.

Resolves: https://linear.app/stream/issue/AND-1093/

Implementation

Removed SyncStatus.SYNC_NEEDED from the local-only guard condition in Message.shouldDeleteRemote(). Messages in SYNC_NEEDED state are pending a sync attempt, so when the user deletes them the remote delete API should be called once connectivity is available.

Updated the corresponding tests to reflect the corrected behavior:

  • SYNC_NEEDEDResult.Success (remote delete allowed)

UI Changes

No UI changes.

Testing

  1. Send a message while online, then go offline.
  2. While offline, attempt to delete the message.
  3. Restore connectivity and verify the message is deleted both locally and remotely.

Summary by CodeRabbit

  • Bug Fixes

    • Improved message deletion logic to refine when local-only deletions are triggered, ensuring proper handling of messages based on their synchronization status.
  • Tests

    • Updated test cases to verify message deletion behavior across multiple synchronization states.

Co-Authored-By: Claude <noreply@anthropic.com>
@VelikovPetar VelikovPetar added the pr:bug Bug fix label Feb 24, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Feb 24, 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.

@VelikovPetar VelikovPetar marked this pull request as ready for review February 24, 2026 11:59
@VelikovPetar VelikovPetar requested a review from a team as a code owner February 24, 2026 11:59
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Feb 24, 2026

Walkthrough

The changes remove SYNC_NEEDED from the local-deletion condition in Message.shouldDeleteRemote method and update the corresponding test cases to verify the new behavior when handling message deletion across different synchronization states.

Changes

Cohort / File(s) Summary
Message Deletion Logic
stream-chat-android-client/src/main/java/io/getstream/chat/android/client/utils/message/MessageUtils.kt
Removed SYNC_NEEDED from the local-deletion condition in shouldDeleteRemote, narrowing the states that trigger local-only deletion.
Test Suite Updates
stream-chat-android-client/src/test/java/io/getstream/chat/android/client/utils/message/MessageUtilsTest.kt
Updated test function inputs and assertions to verify message deletion behavior across FAILED_PERMANENTLY, COMPLETED, AWAITING_ATTACHMENTS, and SYNC_NEEDED states.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 A hop, a skip, we trim the state,
SYNC_NEEDED no longer seals the fate,
Messages now wait their rightful way,
As tests confirm what logic should say,
Simpler flows, cleaner thought today! 🎯

🚥 Pre-merge checks | ✅ 2 | ❌ 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%. 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 delete message functionality for offline messages with SYNC_NEEDED status.
Description check ✅ Passed The PR description includes all required sections: Goal, Implementation, UI Changes, and Testing, with clear explanations of the bug fix and how to verify it.

✏️ 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/fix_delete_message_offline_not_working

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.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Feb 24, 2026

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 🟢

Co-Authored-By: Claude <noreply@anthropic.com>
@sonarqubecloud
Copy link
Copy Markdown

@VelikovPetar VelikovPetar merged commit 982316b into develop Feb 24, 2026
20 of 21 checks passed
@VelikovPetar VelikovPetar deleted the bug/fix_delete_message_offline_not_working branch February 24, 2026 12:44
@stream-public-bot stream-public-bot added the released Included in a release label Feb 24, 2026
@stream-public-bot
Copy link
Copy Markdown
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