Commit afd2b31f authored by Nick Thomas's avatar Nick Thomas

Merge branch 'rename-license-cloud-method' into 'master'

Rename License#cloud? to License#cloud_license?

See merge request gitlab-org/gitlab!60065
parents 6abd47a3 1a30d9ee
......@@ -31,7 +31,7 @@ class Admin::LicensesController < Admin::ApplicationController
@license = License.new(license_params)
return upload_license_error if @license.cloud?
return upload_license_error if @license.cloud_license?
respond_with(@license, location: admin_license_path) do
if @license.save
......
......@@ -29,7 +29,7 @@ module Gitlab
def should_sync_seats?
return false unless license
if license.cloud?
if license.cloud_license?
!license.trial? &&
license.expires_at.present? # Skip sync if license has no expiration
else
......
......@@ -550,12 +550,12 @@ class License < ApplicationRecord
starts_at > Date.current
end
def cloud?
def cloud_license?
license&.type == CLOUD_LICENSE_TYPE
end
def license_type
cloud? ? CLOUD_LICENSE_TYPE : LEGACY_LICENSE_TYPE
cloud_license? ? CLOUD_LICENSE_TYPE : LEGACY_LICENSE_TYPE
end
def auto_renew
......@@ -638,7 +638,7 @@ class License < ApplicationRecord
end
def check_users_limit
return if cloud?
return if cloud_license?
return unless restricted_user_count
if previous_user_count && (prior_historical_max <= previous_user_count)
......
......@@ -10,7 +10,7 @@ module Licenses
def execute
raise ActiveRecord::RecordNotFound unless license
raise Gitlab::Access::AccessDeniedError unless can?(user, :destroy_licenses)
raise DestroyCloudLicenseError.new(_('Cloud licenses can not be removed.')) if license.cloud?
raise DestroyCloudLicenseError.new(_('Cloud licenses can not be removed.')) if license.cloud_license?
license.destroy
end
......
---
title: Rename License#cloud? to License#cloud_license?
merge_request: 60065
author:
type: fixed
......@@ -1407,8 +1407,8 @@ RSpec.describe License do
end
end
describe '#cloud?' do
subject { license.cloud? }
describe '#cloud_license?' do
subject { license.cloud_license? }
context 'when no license provided' do
before 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