Skip to content

Hide snippets of banned users

Hinam Mehra requested to merge anti-abuse/418-hide-snippets-of-banned-users into master

What does this MR do and why?

Screenshots or screen recordings

Context Admin Non-Admin
All Snippets snippets-list-admin snippets-list-non-admin
Personal Snippet personal-snippet-admin personal-snippet-non-admin
Project Snippets projects-snippets-list-admin projects-snippets-list-non-admin
Project Snippet project-snippet-admin project-snippet-non-admin

Database

How to set up and validate locally

  1. Log in as a non-admin user and create a public personal snippet using on /dashboard/snippets.

  2. In a separate window, log-in as admin and invite the above user to a project (eg. gitlab-org/gitlab-test).

  3. Once invited, create another public snippet as the user in step 1 in the gitlab-test project.

  4. As an admin, you should be able to see both-snippets.

  5. Enable feature flag and ban the user that created the snippets:

Feature.enable(:hide_snippets_of_banned_users)
user.ban!
  1. Refresh the page, the admin should still be able to see the snippets but with a spam icon next to them.
  2. Log-in as any other user, they should not be able to see either of the snippets.

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 Hinam Mehra

Merge request reports