Skip to content

fix: profile bio guideline text and unsaved changes dialog#554

Merged
PastaPastaPasta merged 3 commits into
v1.0-devfrom
fix/profile-bio-and-unsaved-changes-dialog
Feb 11, 2026
Merged

fix: profile bio guideline text and unsaved changes dialog#554
PastaPastaPasta merged 3 commits into
v1.0-devfrom
fix/profile-bio-and-unsaved-changes-dialog

Conversation

@PastaPastaPasta
Copy link
Copy Markdown
Member

@PastaPastaPasta PastaPastaPasta commented Feb 11, 2026

Summary

  • Bio character limit fix: The PROFILE_GUIDELINES_INFO_TEXT said bios were limited to 250 characters, but the actual validation enforces 140 characters, the error message says 140, and the character counter shows /140. Fixed the guideline text to match.
  • Unsaved changes confirmation: When canceling profile editing with unsaved changes, a ConfirmationDialog now asks the user to confirm discarding changes instead of silently discarding them (resolves a TODO that was in the code).

Test plan

  • Open DashPay profile screen, verify guideline info text shows "140 characters"
  • Edit a profile field, click Cancel — confirm the "Discard Changes?" dialog appears
  • Click "Keep Editing" — verify you stay in edit mode with changes intact
  • Click "Discard" — verify editing is canceled and changes are discarded
  • Cancel with no unsaved changes — verify no dialog appears

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Adds a confirmation dialog when cancelling unsaved profile edits. The dialog prompts users to "Discard" or "Keep Editing", highlights the discard action as a danger choice, and prevents accidental loss by requiring explicit confirmation.
  • Changes

    • Reduced maximum bio length from 250 to 140 characters and updated guideline text accordingly.

PastaPastaPasta and others added 2 commits February 10, 2026 21:01
The PROFILE_GUIDELINES_INFO_TEXT said bios were limited to 250
characters, but the actual validation enforces 140 characters,
the error message says 140, and the character counter shows /140.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When canceling profile editing with unsaved changes, show a
ConfirmationDialog asking the user to confirm discarding changes
instead of silently discarding them.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Feb 11, 2026

📝 Walkthrough

Walkthrough

Added a confirmation dialog to ProfileScreen to prevent discarding unsaved profile edits; pressing Cancel with unsaved changes now shows a Discard/Keep Editing prompt. Also reduced the bio guideline length from 250 to 140 characters.

Changes

Cohort / File(s) Summary
Profile Screen UI & dialog handling
src/ui/dashpay/profile_screen.rs
Added confirmation_dialog: Option<ConfirmationDialog> to ProfileScreen. On Cancel with unsaved changes, instantiate and render a ConfirmationDialog (labels: "Discard"/"Keep Editing", danger mode). Handle dialog responses to call cancel_editing() or clear the dialog. Updated PROFILE_GUIDELINES_INFO_TEXT bio limit from 250 → 140. Added imports for ConfirmationDialog and ConfirmationStatus.

Sequence Diagram

sequenceDiagram
    actor User
    participant ProfileScreen
    participant ConfirmationDialog

    User->>ProfileScreen: Press Cancel (with unsaved changes)
    ProfileScreen->>ProfileScreen: Detect unsaved changes
    ProfileScreen->>ConfirmationDialog: Create dialog ("Discard"/"Keep Editing")
    ProfileScreen->>User: Render confirmation dialog

    alt User selects Discard
        User->>ConfirmationDialog: Click "Discard"
        ConfirmationDialog->>ProfileScreen: Return Confirm
        ProfileScreen->>ProfileScreen: cancel_editing()
        ProfileScreen->>ProfileScreen: Clear confirmation_dialog
    else User selects Keep Editing
        User->>ConfirmationDialog: Click "Keep Editing"
        ConfirmationDialog->>ProfileScreen: Return Cancel
        ProfileScreen->>ProfileScreen: Clear confirmation_dialog
        ProfileScreen->>User: Resume editing
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 I nudged a button, paused the race,
A gentle dialog took its place.
"Discard or keep?" the rabbit sings,
No lost edits on fluttering wings.
Bios now shorter — 140 delights. 🥕

🚥 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
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and specifically describes both main changes: fixing the profile bio guideline text from 250 to 140 characters and adding an unsaved changes confirmation dialog.

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

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/profile-bio-and-unsaved-changes-dialog

No actionable comments were generated in the recent review. 🎉

🧹 Recent nitpick comments
src/ui/dashpay/profile_screen.rs (1)

903-912: Consider extracting duplicate dialog construction into a helper method.

The same ConfirmationDialog::new(...) with identical title, message, button labels, and danger mode is constructed at both cancel paths (here and line 964). A small helper like fn open_discard_dialog(&mut self) would reduce duplication.

♻️ Suggested helper
+    fn open_discard_dialog(&mut self) {
+        self.confirmation_dialog = Some(
+            ConfirmationDialog::new(
+                "Discard Changes?",
+                "You have unsaved profile changes. Are you sure you want to discard them?",
+            )
+            .confirm_text(Some("Discard"))
+            .cancel_text(Some("Keep Editing"))
+            .danger_mode(true),
+        );
+    }

Then at both cancel sites:

-                                                self.confirmation_dialog = Some(
-                                                    ConfirmationDialog::new(
-                                                        "Discard Changes?",
-                                                        "You have unsaved profile changes. Are you sure you want to discard them?",
-                                                    )
-                                                    .confirm_text(Some("Discard"))
-                                                    .cancel_text(Some("Keep Editing"))
-                                                    .danger_mode(true),
-                                                );
+                                                self.open_discard_dialog();

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
Copy Markdown
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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/ui/dashpay/profile_screen.rs (1)

900-909: ⚠️ Potential issue | 🟡 Minor

Cancel button in wallet-locked branch bypasses the unsaved changes confirmation.

The Cancel button here calls self.cancel_editing() directly, while the Cancel button in the normal (unlocked) branch at Line 950 shows the confirmation dialog when has_unsaved_changes is true. A user could have unsaved edits and then encounter the locked-wallet state, losing changes without confirmation.

Proposed fix: apply the same guard
                                    ui.horizontal(|ui| {
                                        if ui.button("Cancel").clicked() {
-                                            self.cancel_editing();
+                                            if self.has_unsaved_changes {
+                                                self.confirmation_dialog = Some(
+                                                    ConfirmationDialog::new(
+                                                        "Discard Changes?",
+                                                        "You have unsaved profile changes. Are you sure you want to discard them?",
+                                                    )
+                                                    .confirm_text(Some("Discard"))
+                                                    .cancel_text(Some("Keep Editing"))
+                                                    .danger_mode(true),
+                                                );
+                                            } else {
+                                                self.cancel_editing();
+                                            }
                                        }

Alternatively, extract the cancel-with-guard logic into a helper to avoid duplication.

🧹 Nitpick comments (1)
src/ui/dashpay/profile_screen.rs (1)

1355-1369: Nit: simplify with if let to avoid the unwrap.

Line 1357 uses .is_some() + .as_mut().unwrap(). While safe, if let is more idiomatic.

Suggested refactor
-        if self.confirmation_dialog.is_some() {
-            let dialog = self.confirmation_dialog.as_mut().unwrap();
-            let response = dialog.show(ui);
-            match response.inner.dialog_response {
-                Some(ConfirmationStatus::Confirmed) => {
-                    self.confirmation_dialog = None;
-                    self.cancel_editing();
-                }
-                Some(ConfirmationStatus::Canceled) => {
-                    self.confirmation_dialog = None;
-                }
-                None => {}
+        if let Some(dialog) = self.confirmation_dialog.as_mut() {
+            let response = dialog.show(ui);
+            match response.inner.dialog_response {
+                Some(ConfirmationStatus::Confirmed) => {
+                    self.confirmation_dialog = None;
+                    self.cancel_editing();
+                }
+                Some(ConfirmationStatus::Canceled) => {
+                    self.confirmation_dialog = None;
+                }
+                None => {}
             }
         }

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the DashPay profile editing UI to (1) align the “Profile Guidelines” bio limit text with the already-enforced 140-character validation, and (2) prevent accidental loss of edits by adding a discard-changes confirmation dialog when canceling with unsaved changes.

Changes:

  • Update PROFILE_GUIDELINES_INFO_TEXT to state bios are limited to 140 characters.
  • Add ConfirmationDialog flow when canceling profile edits with unsaved changes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/ui/dashpay/profile_screen.rs Outdated
Comment thread src/ui/dashpay/profile_screen.rs
Comment thread src/ui/dashpay/profile_screen.rs
…atic if-let

- The Cancel button in the wallet_locked branch now shows the same
  confirmation dialog as the normal Cancel path when there are unsaved
  profile changes, preventing silent data loss.
- Replace is_some() + unwrap() pattern with idiomatic if let Some().

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@PastaPastaPasta PastaPastaPasta merged commit c6bf7ca into v1.0-dev Feb 11, 2026
4 checks passed
@PastaPastaPasta PastaPastaPasta deleted the fix/profile-bio-and-unsaved-changes-dialog branch February 11, 2026 14:05
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