Skip to content

Refactor for_gitlab_duo_pro and user.duo_pro_add_on_available? usage

Nikola Milojevic requested to merge refactor_for_gitlab_duo_pro into master

What does this MR do and why?

We should refactor the code to utilize CloudConnector::AvailableServices, for both Gitlab.com and Self-managed instances as part of our effort to decouple how the add-ons are bundled with the features.

We introduced a method in CloudConnector::BaseAvailableServiceData in !152407 (merged)

    def purchased?
      add_on_purchases.any?
    end

and this MR replaces any occurrences of ::GitlabSubscriptions::AddOnPurchase.for_gitlab_duo_pro.any?

- ::GitlabSubscriptions::AddOnPurchase.for_gitlab_duo_pro.any?
+ ::CloudConnector::AvailableServices.find_by_name(:dou_chat or :code_suggesitons).purchased?

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

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

How to set up and validate locally

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

Merge request reports