Skip to content

Refactor `CloudActivations::ActivateService` to return needed request structure

Problem

When activating a GitLab instance with an activation code, a request will be sent to the CustomersDot's activation GraphQL mutation. The mutation calls the CloudActivations::ActivateService which returns a result that is then modified for the request response. The modification of the return result is an unnecessary step since the CloudActivations::ActivateService is only used by the activation GraphQL mutation.

Proposal

The CloudActivations::ActivateService should build the result as needed by the GraphQL mutation since it's only used in this one place. For a successful activation, the returned hash needs to return the keys success, license_key, future_subscriptions and errors with the required values. The same structure needs to be applied for unsuccessful activations.

Result

Simplification of the code by returning what is needed in the first place instead of modifying the result again.

Edited by Corinna Gogolok