Add service and client to deregister Suggested Reviewers projects
What does this MR do and why?
This MR introduces a service and client to deregister projects from Suggested Reviewers. This allows projects to be removed from merge requests data extraction as well as other metadata stored on the Suggested Reviewers side.
The client-facing feature is behind a feature flag suggested_reviewers_control
which is current disabled by default.
Components highlighted in #e9967a
are part of this MR.
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
How to set up and validate locally
- Set ultimate license on a group
http://gdk.test:3000/admin/groups
- Create a project in the ultimate group or use an existing one, e.g.
http://gdk.test:3000/gitlab-org/gitlab-test
- Start rails console
bundle exec rails c
- Enable SAAS simulation and create a random secret
ENV['GITLAB_SIMULATE_SAAS'] = '1' ENV['SUGGESTED_REVIEWERS_SECRET'] = SecureRandom.hex(32)
- Set the feature flag
project = Project.find(2) Feature.enable(:suggested_reviewers_control, project)
- Disable the suggested reviewers setting
project.project_setting.update(suggested_reviewers_enabled: false) project.reload
- Invoke the service and observe the response object (failure is due to the Suggested Reviewers service is not configured).
user = User.first service = ::Projects::DeregisterSuggestedReviewersProjectService.new(project: project, current_user: user) service.execute => #<ServiceResponse:0x000000016810fc20 @http_status=nil, @message="Failed to deregister project", @payload={}, @reason=:client_request_failed, @status=:error>
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #393147 (closed)
Edited by Tan Le