Skip to content

Support banned projects in the VisibilityIcon component

  • Please check this box if this contribution uses AI-generated content (including content generated by GitLab Duo features) as outlined in the GitLab DCO & CLA

What does this MR do and why?

Whilst porting the Project header from HAML to Vue I noticed that the current VisibilityIcon doesn't support the spam state that can happen to projects when a user is banned.

There are 2 approaches to updating the component, and happy to go with either approach that the team would prefer.

Update the component to handle the state (this MR)

Easiest solution is to just add a check in the VisibilityIcon component to check if we're rendering a project and if the "visibilitylevel" is banned and handle it there.

This makes sense because "banned" isn't actually a visibility level, but kind of an override for the visibility. If you check visibility_level.rb you can see that there is no mention of a "banned" level.

Update visibility_level/constants.js to handle spam/banned levels

This would keep the component simpler, but would make the JS file diverge from what the backend thinks of as a visibility level.

I think updating this would be preferred if we could also look into updating the backend because this would centralise the handling of banned projects, which currently seems to be "tacked on" to the other visibility levels. This would require significantly more work to complete though and likely end up touching a lot of different parts of the system to remove the existing handling of banned statuses.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Before After
N/A image

How to set up and validate locally

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

Closes: #457842 (closed) Ref: #457848

Edited by Andrew Smith

Merge request reports