Implement conditional link to Discover Security Page
Why are we doing this work
In &4787 (comment 503056787) it was determined that ideally the upgrade or free trial link would point to the Discover Security page (project_security_discover_path) for users who can access it, and to https://about.gitlab.com/pricing/ for users who can't.
In practice, this would mean that users get a link to the Discover Security page when all of the follow conditions are met (see https://gitlab.com/gitlab-org/gitlab/blob/fe63b388fe285a4906a30b5d6ced2aff98fd4733/ee/app/helpers/ee/projects_helper.rb#L303-308):
- They're on GitLab.com
- They're viewing a project in a group/namespace they are an admin of
- They're on any plan except Ultimate
If one of more of these isn't true, they'll see a link to https://about.gitlab.com/pricing/.
In !53412 (merged), the link to https://about.gitlab.com/pricing/ is hard-coded, so all users will be linked there. This was done to expedite the feature as a whole. At the time of writing that MR is not yet merged, and while we could address this issue in that MR, that MR is already a bit large.
This issue is about conditionally pointing the link to the relevant URL.
Relevant links
Non-functional requirements
- [-] Documentation:
- [-] Feature flag:
- [-] Performance:
-
Testing: helper specs for link
Implementation plan
-
Add show_discover_project_security?method toapp/helpers/projects_helper.rbthat returnsfalse -
overridesame method inee/app/helpers/ee/projects_helper.rb, and returnsuperif condition isn't met -
Update app/views/projects/security/configuration/show.html.hamlto conditionally pass the correct link based onshow_discover_project_security? -
Pass through to frontend Vue component via dataset/provide/inject.
Alternatively, it might be better to create configuration_helper.rb files in EE and CE, since project_security_discover_path doesn't actually exist in FOSS, so technically shouldn't be referenced in a CE template...