Skip to content

Hide forks count if user does not have access to public project's repo

Ravi Kumar requested to merge 37977-forks_count-leaked-on-web-pages into master

What does this MR do and why?

This MR will hide the forks count for the public project with restricted repository restriction if the user does not have access to the project. There is a refactoring as well. I have removed the methods show_merge_request_count? and show_issue_count? because both methods were doing the same thing. So instead I have created a new method show_count?

Screenshots or screen recordings

Forks count is hidden Screenshot_2023-01-15_at_17.44.04

How to set up and validate locally

  1. Run the local development
gdk start
  1. Log in as an admin user and change the Repository accessibility setting to the Only Project Members for a public project.
  2. Without login go to http://127.0.0.1:3000/explore and verify that the forks count is not visible
  3. Without login search for the project http://127.0.0.1:3000/search and verify that the forks count is not visible on the search page
  4. Repeat steps 3 and 4 with login as a user who is not a member of the project

MR acceptance checklist

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

Related to #37977

Edited by Ravi Kumar

Merge request reports

Loading