diff --git a/CHANGELOG-EE b/CHANGELOG-EE index 2e1d0f99105cf7eeffe3a4ef901ec2cffe7b3678..ce4bdcabf6a92b101f5e0c26b12f3825bdf54298 100644 --- a/CHANGELOG-EE +++ b/CHANGELOG-EE @@ -5,6 +5,9 @@ v 8.9.0 (unreleased) - Allow LDAP to mark users as external based on their group membership. !432 - Instrument instance methods of Gitlab::InsecureKeyFingerprint class +v 8.8.4 + - Remove license overusage message + v 8.8.3 - Add standard web hook headers to Jenkins CI post. !374 - Gracefully handle malformed DNs in LDAP group sync. !392 diff --git a/app/helpers/license_helper.rb b/app/helpers/license_helper.rb index 90c0def8f926edbdbcf7282609731d45a0f7293f..41574afed9e470f541b776710b557c95c6d49210 100644 --- a/app/helpers/license_helper.rb +++ b/app/helpers/license_helper.rb @@ -37,15 +37,13 @@ module LicenseHelper return unless signed_in - return unless (is_admin && (license.notify_admins? || license.warn_upgrade_license_message?)) || license.notify_users? + return unless (is_admin && license.notify_admins?) || license.notify_users? message = [] - unless license.warn_upgrade_license_message? - message << "The GitLab Enterprise Edition license" - message << (license.expired? ? "expired" : "will expire") - message << "on #{license.expires_at}." - end + message << "The GitLab Enterprise Edition license" + message << (license.expired? ? "expired" : "will expire") + message << "on #{license.expires_at}." if license.expired? && license.will_block_changes? message << "Pushing code and creation of issues and merge requests" @@ -67,12 +65,6 @@ module LicenseHelper message << "to" message << (license.block_changes? ? "restore" : "ensure uninterrupted") message << "service." - elsif license.warn_upgrade_license_message? - message << "Your GitLab license currently covers #{license.user_count}" - message << "users, but it looks like your site has grown to" - message << "#{current_active_user_count} users. Please contact" - message << "sales@gitlab.com to increase the number of licensed users." - message << "Note: This message is only visible to you as an admin." end message.join(" ") diff --git a/app/models/license.rb b/app/models/license.rb index a917985513459460159b9d9bffd96bc1d81d05ef..b788832416d75cb66cc52d25764c790a94e1f53d 100644 --- a/app/models/license.rb +++ b/app/models/license.rb @@ -92,22 +92,6 @@ class License < ActiveRecord::Base self.restrictions[:active_user_count] end - def current_user_count - Rails.cache.fetch("current_active_user_count", expires_in: 1.hour) do - User.active.count - end - end - - def warn_upgrade_license_message? - restricted_user_count = user_count - - return unless restricted_user_count - - return false unless Time.now >= self.starts_at + 3.months - - restricted_user_count && current_user_count > restricted_user_count - end - private def reset_current diff --git a/spec/helpers/license_helper_spec.rb b/spec/helpers/license_helper_spec.rb index 49786da54d72cb2fdf0786b41d871b618e76c4ae..f2a94a79cd2759d4fdee0bcd4a314d5f4125929d 100644 --- a/spec/helpers/license_helper_spec.rb +++ b/spec/helpers/license_helper_spec.rb @@ -19,25 +19,5 @@ describe LicenseHelper do expect(license_message(signed_in: true, is_admin: false)).to eq(user_msg) end end - - context 'license available' do - let(:license) { create(:license) } - - before do - allow(License).to receive(:current).and_return(license) - end - - it 'warn for overusage' do - allow(license).to receive(:starts_at).and_return(Time.now - 3.months) - allow(license).to receive(:expired?).and_return(false) - allow(license).to receive(:restricted?).and_return(true) - allow(license).to receive(:notify_admins?).and_return(true) - allow(license).to receive(:restrictions).and_return({ active_user_count: 50 }) - allow(User).to receive(:active).and_return(Array.new(100)) - - warn_msg = 'Your GitLab license currently covers 50 users, but it looks like your site has grown to 100 users. Please contact sales@gitlab.com to increase the number of licensed users. Note: This message is only visible to you as an admin.' - expect(license_message(signed_in: true, is_admin: true)).to eq(warn_msg) - end - end end end