Skip to content

CMM-2487: Allow clearing the Web Address in Account Settings - #23403

Open
le-sgs wants to merge 1 commit into
wordpress-mobile:trunkfrom
le-sgs:fix/cmm-2487-clear-web-address
Open

le-sgs wants to merge 1 commit into
wordpress-mobile:trunkfrom
le-sgs:fix/cmm-2487-clear-web-address

Conversation

@le-sgs

@le-sgs le-sgs commented Oct 8, 2026

Copy link
Copy Markdown

TL;DR

Once the Web Address in Jetpack Android's Account Settings was set, it couldn't be cleared: the OK button was disabled whenever the field was empty. Calypso and Jetpack iOS already allow clearing it. This PR lets an empty Web Address be saved.

Attempts to fix CMM-2487.

Description

Cause:
EditTextPreferenceWithValidation enables the dialog's OK button on each keystroke only when the text matches Patterns.WEB_URL (ValidationType.URL). An empty string never matches, so once the field is cleared OK stays disabled, and Cancel restores the saved value.

Change:

  • Add validateOptionalUrl() to ValidationUtils.kt. It accepts an empty value or a valid URL, the same rule UnifiedCommentsEditViewModel already applies to the comment author's web address.
  • Use it for ValidationType.URL. Web Address in Account Settings is the only preference that uses this validation type, so no other screen is affected.
  • Whitespace-only input still keeps OK disabled, as before.

Nothing else needed to change: AccountSettingsViewModel → PushAccountSettingsUseCase already sends the value through as user_URL, and FluxC updates webAddress from the response, so an empty value is pushed and shown as blank.

Testing instructions

Clear the Web Address:

  1. In the Jetpack app, go to Me → Account Settings → Web Address
  2. If it's blank, enter a URL (e.g. https://example.com), tap OK, and wait for it to save
  3. Open Web Address again and delete all the text
  • Verify OK stays enabled
  1. Tap OK
  • Verify Web Address is now blank in Account Settings
  1. Leave and reopen Account Settings
  • Verify Web Address is still blank, and is also blank on WordPress.com → Account Settings

Validation still works:

  1. Open Web Address and type not a url
  • Verify OK is disabled
  1. Type a valid URL
  • Verify OK is enabled and the URL saves

Verified:

  • Tested on an emulator (Pixel 8, Android 16) with a Jetpack debug build of this branch. All of the checks above pass: OK stays enabled when the field is cleared, the Web Address saves as blank and stays blank after reopening Account Settings, and invalid input still disables OK.
  • ValidationUtilsTest passes, including a new test for the empty value, and that test fails with the empty-value check removed.

Screenshot of the "OK" button still active when the web address field is blank:
CleanShot 2026-10-08 at 9 04 57 PM@2x

- The Web Address dialog enabled OK only for text matching
  Patterns.WEB_URL, so an empty field kept OK disabled and the
  value could not be cleared once set
- Add validateOptionalUrl(), which accepts an empty value or a
  valid URL, and use it for the URL validation type (only used by
  Web Address)
- The save path already sends an empty user_URL, matching Calypso
  and Jetpack iOS

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

1 participant