-
Notifications
You must be signed in to change notification settings - Fork 368
fix(ui): ensure dialog confirmation for delete/flag actions #2384
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
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`).
WalkthroughUpdated 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
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
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (5 passed)
✨ Finishing touches🧪 Generate unit tests
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. Comment |
@coderabbitai review |
✅ Actions performedReview triggered.
|
1 similar comment
✅ Actions performedReview triggered.
|
There was a problem hiding this 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.
📒 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)
andif (confirmFlag != true)
(lines 1108, 1142). No== false
/!= false
matches detected.
Codecov Report❌ Patch coverage is
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. 🚀 New features to boost your workflow:
|
Submit a pull request
Fixes: FLU-254
Description of the pull request
This PR updates the
_showDeleteMessageDialog
and_showFlagMessageDialog
methods inMessageWidget
.Previously, if the user dismissed the confirmation dialog (e.g., by tapping outside), the
showDialog
method would returnnull
. The existing checks (confirmDelete == false
andconfirmFlag == false
) would evaluate totrue
in this scenario, causing the delete/flag action to proceed unintentionally.The checks have been changed to
confirmDelete != true
andconfirmFlag != true
to ensure that the actions only proceed if the user explicitly confirms by tapping the "Yes" button (which returnstrue
)Summary by CodeRabbit
Bug Fixes
Documentation