Skip to content

Switch to rails-ujs

Heinrich Lee Yu requested to merge switch-to-rails-ujs into master

What does this MR do?

  1. Switch to @rails/ujs package

    Remove jquery-ujs and use rails-ujs instead

  2. Fix counting of pending AJAX requests

    @rails/ujs uses native XHR rather than jQuery AJAX. Thus we add event listeners to count pending Rails UJS requests. This uses the same methodology as our request counting for axios.

  3. Disable usage of csrf token in Rails

    Rails UJS .csrfToken doesn't seem to overrideable. As it uses the same methodology under the hood, we do not need to cache the CSRF token:

    https://github.com/rails/rails/blob/master/actionview/app/assets/javascripts/rails-ujs/utils/csrf.coffee#L5-L8

  4. Ensure that leave_url pages have Rails initialized

    On these pages we need Rails initialized immediately in order to be able to get the confirmation dialog toggled. As we defer initialization in main.js, it might be too late.

  5. Fix the user notifications spec

Closes #219253 (closed)

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

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
Edited by Lukas 'ai-pi' Eipert

Merge request reports