Commit 6d9df1c3 authored by Corinna Wiesner's avatar Corinna Wiesner

Display license ID retrieved from CustomersDot

Prior to this changes, the displayed license ID was the one from
GitLab's license database table instead of the one retrieved from
CustomersDot. While the right logic was supposed to be used, the
global_id logic used the license's id instead of the license_id method
as used in the graphql resolvers.
This change will fix the issue with the global id logic by overriding
the id method in the resolver with a custom global id logic that uses
the license_id method.

Changelog: changed
EE: true
parent dcfdc833
...@@ -9724,7 +9724,7 @@ Represents the current license. ...@@ -9724,7 +9724,7 @@ Represents the current license.
| <a id="currentlicensecreatedat"></a>`createdAt` | [`Date`](#date) | Date when the license was added. | | <a id="currentlicensecreatedat"></a>`createdAt` | [`Date`](#date) | Date when the license was added. |
| <a id="currentlicenseemail"></a>`email` | [`String`](#string) | Email of the licensee. | | <a id="currentlicenseemail"></a>`email` | [`String`](#string) | Email of the licensee. |
| <a id="currentlicenseexpiresat"></a>`expiresAt` | [`Date`](#date) | Date when the license expires. | | <a id="currentlicenseexpiresat"></a>`expiresAt` | [`Date`](#date) | Date when the license expires. |
| <a id="currentlicenseid"></a>`id` | [`ID!`](#id) | ID of the license. | | <a id="currentlicenseid"></a>`id` | [`ID!`](#id) | ID of the license extracted from the license data. |
| <a id="currentlicenselastsync"></a>`lastSync` | [`Time`](#time) | Date when the license was last synced. | | <a id="currentlicenselastsync"></a>`lastSync` | [`Time`](#time) | Date when the license was last synced. |
| <a id="currentlicensemaximumusercount"></a>`maximumUserCount` | [`Int`](#int) | Highest number of billable users on the system during the term of the current license. | | <a id="currentlicensemaximumusercount"></a>`maximumUserCount` | [`Int`](#int) | Highest number of billable users on the system during the term of the current license. |
| <a id="currentlicensename"></a>`name` | [`String`](#string) | Name of the licensee. | | <a id="currentlicensename"></a>`name` | [`String`](#string) | Name of the licensee. |
...@@ -12216,7 +12216,7 @@ Represents an entry from the Cloud License history. ...@@ -12216,7 +12216,7 @@ Represents an entry from the Cloud License history.
| <a id="licensehistoryentrycreatedat"></a>`createdAt` | [`Date`](#date) | Date when the license was added. | | <a id="licensehistoryentrycreatedat"></a>`createdAt` | [`Date`](#date) | Date when the license was added. |
| <a id="licensehistoryentryemail"></a>`email` | [`String`](#string) | Email of the licensee. | | <a id="licensehistoryentryemail"></a>`email` | [`String`](#string) | Email of the licensee. |
| <a id="licensehistoryentryexpiresat"></a>`expiresAt` | [`Date`](#date) | Date when the license expires. | | <a id="licensehistoryentryexpiresat"></a>`expiresAt` | [`Date`](#date) | Date when the license expires. |
| <a id="licensehistoryentryid"></a>`id` | [`ID!`](#id) | ID of the license. | | <a id="licensehistoryentryid"></a>`id` | [`ID!`](#id) | ID of the license extracted from the license data. |
| <a id="licensehistoryentryname"></a>`name` | [`String`](#string) | Name of the licensee. | | <a id="licensehistoryentryname"></a>`name` | [`String`](#string) | Name of the licensee. |
| <a id="licensehistoryentryplan"></a>`plan` | [`String!`](#string) | Name of the subscription plan. | | <a id="licensehistoryentryplan"></a>`plan` | [`String!`](#string) | Name of the subscription plan. |
| <a id="licensehistoryentrystartsat"></a>`startsAt` | [`Date`](#date) | Date when the license started. | | <a id="licensehistoryentrystartsat"></a>`startsAt` | [`Date`](#date) | Date when the license started. |
...@@ -8,8 +8,7 @@ module Types ...@@ -8,8 +8,7 @@ module Types
included do included do
field :id, GraphQL::Types::ID, null: false, field :id, GraphQL::Types::ID, null: false,
description: 'ID of the license.', description: 'ID of the license extracted from the license data.'
method: :license_id
field :type, GraphQL::Types::String, null: false, field :type, GraphQL::Types::String, null: false,
description: 'Type of the license.', description: 'Type of the license.',
...@@ -48,6 +47,10 @@ module Types ...@@ -48,6 +47,10 @@ module Types
field :users_in_license_count, GraphQL::Types::Int, null: true, field :users_in_license_count, GraphQL::Types::Int, null: true,
description: 'Number of paid users in the license.', description: 'Number of paid users in the license.',
method: :restricted_user_count method: :restricted_user_count
def id
::Gitlab::GlobalId.build(object, model_name: object.class.to_s, id: object.license_id).to_s
end
end end
end end
end end
......
...@@ -48,7 +48,7 @@ RSpec.shared_examples_for 'license type fields' do ...@@ -48,7 +48,7 @@ RSpec.shared_examples_for 'license type fields' do
describe 'id' do describe 'id' do
let(:field_name) { :id } let(:field_name) { :id }
it { is_expected.to eq(license.to_global_id) } it { is_expected.to include(license.license_id.to_s) }
end end
describe 'type' do describe 'type' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment