Refactor(profile preferences): refactor rails eval [RUN-AS-IF-FOSS]
What does this MR do?
This MR refactors the rails eval
'ed profiles/preferences/update.js.erb to form event listener functions.
Screenshots (strongly suggested)
This is the page that is being refactored, no visible change:
Before | After |
---|---|
Does this MR meet the acceptance criteria?
Conformity
- [-] Changelog entry
- [-] Documentation (if required)
-
Code review guidelines -
Merge request performance guidelines -
Style guides - [-] Database guides
-
Separation of EE specific content
Availability and Testing
To test this out:
- Run
bundle exec rails c
and enable this feature flag:Feature.enable(:user_time_settings)
- If that doesn't work set
userTimeSettings = true
(default totrue
) in profile_preferences_bundle.js
- If that doesn't work set
- Navigate to http://localhost:3000/profile/preferences and scroll to the bottom.
- Change settings (note: radio buttons submit the form immediately!)
- Click "Save changes"
- Refresh the page, you should see the changes persisted
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. -
Tested in all supported browsers - [-] Informed Infrastructure department of a default or new setting change, if applicable per definition of done
Security
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
- [-] Label as security and @ mention
@gitlab-com/gl-security/appsec
- [-] The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
- [-] Security reports checked/validated by a reviewer from the AppSec team
Related to #250846 (closed)
Edited by Jose Ivan Vargas