Skip to content

Conversation

xsahil03x
Copy link
Member

@xsahil03x xsahil03x commented Sep 19, 2025

Submit a pull request

Fixes: FLU-254

Description of the pull request

This PR updates the _showDeleteMessageDialog and _showFlagMessageDialog methods in MessageWidget.

Previously, if the user dismissed the confirmation dialog (e.g., by tapping outside), the showDialog method would return null. The existing checks (confirmDelete == false and confirmFlag == false) would evaluate to true in this scenario, causing the delete/flag action to proceed unintentionally.

The checks have been changed to confirmDelete != true and confirmFlag != true to ensure that the actions only proceed if the user explicitly confirms by tapping the "Yes" button (which returns true)

Summary by CodeRabbit

  • Bug Fixes

    • Prevented delete and flag actions from triggering when their confirmation dialogs are dismissed or canceled. Actions now execute only after explicit confirmation, reducing accidental deletions or flags.
  • Documentation

    • Updated CHANGELOG with an Upcoming Beta section noting the fix for delete/flag dialogs requiring explicit confirmation.

This commit updates the `_showDeleteMessageDialog` and `_showFlagMessageDialog` methods in `MessageWidget`.

Previously, if the user dismissed the confirmation dialog (e.g., by tapping outside), the `showDialog` method would return `null`. The existing checks (`confirmDelete == false` and `confirmFlag == false`) would evaluate to `true` in this scenario, causing the delete/flag action to proceed unintentionally.

The checks have been changed to `confirmDelete != true` and `confirmFlag != true` to ensure that the actions only proceed if the user explicitly confirms by tapping the "Yes" button (which returns `true`).
Copy link
Contributor

coderabbitai bot commented Sep 19, 2025

Walkthrough

Updated CHANGELOG with a Fixed entry. Adjusted destructive-action flows in message_widget.dart so delete/flag actions only execute on explicit true confirmations; dismissals or cancellations no longer trigger actions.

Changes

Cohort / File(s) Summary
Documentation: Changelog
packages/stream_chat_flutter/CHANGELOG.md
Added Upcoming Beta -> Fixed note: delete/flag dialogs no longer execute when dismissed without confirmation.
Message actions confirmation logic
packages/stream_chat_flutter/lib/src/message_widget/message_widget.dart
Changed checks to require == true for delete/flag confirmations; null or false now cancel the action.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant U as User
  participant MW as MessageWidget
  participant CD as ConfirmationDialog
  participant S as Stream Chat API

  U->>MW: Long-press message → Delete / Flag
  MW->>CD: Show confirmation dialog
  CD-->>MW: User response (true / false / null)
  alt response == true
    MW->>S: Perform destructive action (delete/flag)
    S-->>MW: Result
    MW-->>U: Update UI with action outcome
  else response is false or null
    MW-->>U: Dismiss dialog, no action taken
  end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested reviewers

  • renefloor

Poem

A tap, a pop, a cautious pause—
No hasty paws on risky laws.
I nibble “true” to make it so,
Else hop away and let it go.
Dialogs close, but bunnies know:
Only yes makes carrots flow. 🥕🐇

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The PR title "fix(ui): ensure dialog confirmation for delete/flag actions" is concise, single-sentence, and accurately summarizes the primary change in MessageWidget (requiring explicit confirmation for delete/flag flows) while matching the changelog update, so a teammate scanning history will understand the intent.
Linked Issues Check ✅ Passed The modifications to _maybeDeleteMessage and _maybeFlagMessage change the checks from '== false' to '!= true', so a dismissed dialog (showDialog returning null) will not trigger deletion or flagging, which directly addresses FLU-254's reported reproduction and expected behavior; the changelog entry documents the fix and no public API changes were introduced, so the coding requirements of the linked issue are met.
Out of Scope Changes Check ✅ Passed The PR only updates MessageWidget's confirmation logic and the package CHANGELOG.md; there are no other file or public API changes evident in the provided summary, so no out-of-scope or unrelated changes were introduced.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/message-delete-confirm-dismiss

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.

@xsahil03x
Copy link
Member Author

xsahil03x commented Sep 19, 2025

@coderabbitai review

Copy link
Contributor

coderabbitai bot commented Sep 19, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

1 similar comment
Copy link
Contributor

coderabbitai bot commented Sep 19, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Contributor

@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: 0

🧹 Nitpick comments (1)
packages/stream_chat_flutter/CHANGELOG.md (1)

1-6: Avoid a new “Upcoming Beta” section; merge into existing “Upcoming” or tag a concrete version.

You already have an “Upcoming” section below. Duplicating with “Upcoming Beta” will fragment notes. Either:

  • Move this bullet under the existing “Upcoming > Fixed”, or
  • Rename the header to the next prerelease (e.g., 10.0.0‑beta.6) if you’re cutting a tag.

Apply within this hunk (removal):

-## Upcoming Beta
-
-🐞 Fixed
-
-- Fixed delete/flag message dialogs executing action when dialog is dismissed without confirmation.

Then add the bullet under the existing “Upcoming > Fixed” section (outside this hunk).

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 0f8a4f5 and 40f3c65.

📒 Files selected for processing (2)
  • packages/stream_chat_flutter/CHANGELOG.md (1 hunks)
  • packages/stream_chat_flutter/lib/src/message_widget/message_widget.dart (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: build (ios)
  • GitHub Check: build (android)
  • GitHub Check: test
  • GitHub Check: analyze
🔇 Additional comments (3)
packages/stream_chat_flutter/lib/src/message_widget/message_widget.dart (3)

1097-1111: Correct null-safe confirmation guard for Delete. LGTM.

confirmDelete != true correctly treats dismiss and “Cancel” (null/false) as cancel, preventing accidental deletes. Matches the issue’s intent.


1131-1146: Correct null-safe confirmation guard for Flag. LGTM.

Same pattern here; only an explicit “Yes” proceeds.


1097-1111: No action required — confirmation guards already use != true.

Found two showStreamDialog usages in packages/stream_chat_flutter/lib/src/message_widget/message_widget.dart (lines 1097, 1131); both use if (confirmDelete != true) and if (confirmFlag != true) (lines 1108, 1142). No == false/!= false matches detected.

Copy link

codecov bot commented Sep 19, 2025

Codecov Report

❌ Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (v10.0.0@0f8a4f5). Learn more about missing BASE report.

Files with missing lines Patch % Lines
...flutter/lib/src/message_widget/message_widget.dart 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             v10.0.0    #2384   +/-   ##
==========================================
  Coverage           ?   64.92%           
==========================================
  Files              ?      419           
  Lines              ?    25942           
  Branches           ?        0           
==========================================
  Hits               ?    16844           
  Misses             ?     9098           
  Partials           ?        0           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@xsahil03x xsahil03x merged commit 90d5bc2 into v10.0.0 Sep 19, 2025
9 checks passed
@xsahil03x xsahil03x deleted the fix/message-delete-confirm-dismiss branch September 19, 2025 10:10
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.

2 participants