Skip to content

Ensure project is persisted when generating new issue link

What does this MR do and why?

This ensures that a project actually exists before attempting to generate the "Create issue" shortcut link for it. This fixes an issue where, if you visited the "Create project" page as an admin with the new nav enabled, the page would error-out. The reason seems to be that, on that page, a Project is instantiated, but not persisted, so the left side of the condition passed, bringing us to the permission check. For some reason, can? returned true, indicating that an admin is allowed to create issues in a project that does not exist. This might be the intended behavior though, and we should definitely check whether the project is persisted first.

Screenshots or screen recordings

Before After
Screenshot_2023-04-21_at_6.22.44_PM Screenshot_2023-04-21_at_6.18.50_PM

How to set up and validate locally

  1. Sign-in as an admin.
  2. Enable the new nav:
    1. Enable the feature flag:

      echo "Feature.enable(:super_sidebar_nav)" | rails c
    2. Enable the user setting from the user dropdown:

      Screenshot_2022-12-13_at_1.32.43_PM

  3. Navigate to the "New project" page at http://gdk.test:3000/projects/new.
    • Before these changes, you should see an error 500. After the changes, the page should load normally.

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 Paul Gascou-Vaillancourt

Merge request reports

Loading