Page MenuHomePhabricator

[lib/native] introduce useIsKeyserverURLValid hook
ClosedPublic

Authored by ginsu on Oct 31 2023, 9:53 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Nov 8, 12:02 PM
Unknown Object (File)
Fri, Nov 8, 11:11 AM
Unknown Object (File)
Fri, Nov 8, 10:02 AM
Unknown Object (File)
Fri, Nov 8, 9:29 AM
Unknown Object (File)
Fri, Nov 8, 9:25 AM
Unknown Object (File)
Fri, Nov 8, 9:17 AM
Unknown Object (File)
Mon, Oct 28, 12:14 AM
Unknown Object (File)
Oct 5 2024, 8:23 PM
Subscribers

Details

Summary

To validate that the keyserver url the user inputted into the add keyserver input exists we should call the getVersion endpoint. The logic for this actually already exists in the KeyserverSelection component in the new registation flow. This diff factors out the shared logic into a seperate hook called useIsKeyserverURLValid.

Linear task: https://linear.app/comm/issue/ENG-5337/factor-out-shared-validation-logic-in-the-onsubmit-callback-in

Depends on D9665

Test Plan

Followed the test plan in D8198 and made sure that there were no regressions

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

native/account/registration/keyserver-selection.react.js
94 ↗(On Diff #32583)

Why was this change made?

126–128 ↗(On Diff #32583)

This condition doesn't appear to have been "migrated" to the new function. The button should be disabled if keyserverURL isn't set, but it's still good to be safe in case there is a race condition where the input is cleared and then the button is pressed before the button state updates

native/account/registration/keyserver-selection.react.js
94 ↗(On Diff #32583)

I initially had the keyserverURL param in useIsKeyserverURLValid be required; however, based on other inline comment, I will make it optional and bring the !keyserverURL condition into useIsKeyserverURLValid

This revision is now accepted and ready to land.Nov 2 2023, 7:00 AM

update after @inka's recently landed diffs

This revision was landed with ongoing or failed builds.Dec 4 2023, 10:31 PM
This revision was automatically updated to reflect the committed changes.