Settings page: Remove save button, blur input and change APIs
Description
This PR removes the html form functionality of the settings page and replaces it with auto-save with debouncing. It also changes APIv1 endpoints to reflect similar AJAX calls, and modifies multiple_locale_selector behaviour.
Fixes #3746 Fixes #3844
TODO:
- [x] ~Discuss email field debouncing issue~
- [x] ~Locale Selector auto-save is not finished~
- [x] ~Remove Save button~
- [x] ~Test cases need to be rewritten due to behavior change~
Additional Notes
~I noticed that the multiple_locale_selector and the preferred_locale_selector et. al still includes locales like bn_BD and bn-IN.~ See #3854.
~Also, one concern I have for this implementation lies with the email field. If a user wants, they can spam random emails with verification mail by changing a letter of the input every 2 seconds. Also, if a user doesn't finish writing out said email within 2 seconds, it will submit due to the debouncing, accidentally sending an email to someone else.~
This PR is doing multiple things at once. It's hard to review it with all the changes in a single commit.
Could you please first separate the changeset into multiple commits?
- one for introduction of the
Fieldwidget. - one for https://github.com/mozilla/pontoon/issues/3746
- one for https://github.com/mozilla/pontoon/issues/3844
- changes of the
multiple_locale_selectorbehaviour (are there really any?)
I would also prefer if we save on blur (“I left the field, it’s done”, fewer saves than per-keystroke).
Also, one concern I have for this implementation lies with the email field. If a user wants, they can spam random emails with verification mail by changing a letter of the input every 2 seconds. Also, if a user doesn't finish writing out said email within 2 seconds, it will submit due to the debouncing, accidentally sending an email to someone else.
Another reason to use the blur event.
Codecov Report
:x: Patch coverage is 87.69231% with 8 lines in your changes missing coverage. Please review.
:white_check_mark: Project coverage is 78.68%. Comparing base (74b4ca1) to head (53b06eb).
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
- :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.