Skip to content

Fix: add before_action new_license for fix-license-disappear

What does this MR do and why?

Describe in detail what your merge request does and why.

related to #383044

When updating some settings, once some settings do not meet the requirements, such as set Globally-allowed IP ranges to a error value, the license addition option is disappear.

This MR is to solve this question.

when we update some illegal settings, the rails will check the settings and render the returned page with some error tips. But when we render the general page with error notice, the code logic is that We render the page first and then initialize the new_license variable, but the fact is that when we finish rendering the page, we go straight back without initializing the new_license, so the license addition option won't render because it's controlled by the variable new_license.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After
before after

How to set up and validate locally

because this password expiration feature is used by JH. so if you want to set up and validate, you should

  1. checkout the main-jh branch
git checkout main-jh
  1. add jh config in .bundle/config
---
BUNDLE_SET: "without production"
BUNDLE_JOBS: "5"
BUNDLE_GEMFILE: "jh/Gemfile"
  1. In rails console enable the feature.
Feature.enable(:password_expiration)
  1. act with the video.

ref:

  1. https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/controllers/admin/application_settings_controller.rb#L310
  2. https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/app/views/admin/application_settings/_add_license.html.haml#L1

/cc @prajnamas

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Deepika Guliani

Merge request reports