Skip to content

Introduce eligible_for_self_managed_code_suggestions? method

What does this MR do and why?

In efforts running on Epic #11996, we need to have a method to check if a user is eligible for code suggestions on self-managed instances.

We are introducing this method because it will be used in different places.

A user is eligible if they are human, and also guests. Excluding bots, blocked, banned, and pending_approval users. Please refer to Issue #432211 for the criteria of eligible users.

In this MR, we:

  • Add the method as an instance method on the user level
  • Add specs to cover changes

How to set up and validate locally

You can test the method against non-eligible and eligible users, for example:

user.can?(:use_sm_code_suggestions)

Given the test coverage, green specs are enough!

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 #432212

Edited by Mohamed Hamda

Merge request reports

Loading