diff options
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/application_setting.rb | 3 | ||||
-rw-r--r-- | app/models/application_setting_implementation.rb | 1 | ||||
-rw-r--r-- | app/models/users_statistics.rb | 33 |
3 files changed, 27 insertions, 10 deletions
diff --git a/app/models/application_setting.rb b/app/models/application_setting.rb index 9254f7dd633..c1e44748304 100644 --- a/app/models/application_setting.rb +++ b/app/models/application_setting.rb @@ -142,6 +142,9 @@ class ApplicationSetting < ApplicationRecord validates :default_artifacts_expire_in, presence: true, duration: true + validates :container_expiration_policies_enable_historic_entries, + inclusion: { in: [true, false], message: 'must be a boolean value' } + validates :container_registry_token_expire_delay, presence: true, numericality: { only_integer: true, greater_than: 0 } diff --git a/app/models/application_setting_implementation.rb b/app/models/application_setting_implementation.rb index 418fb18cc91..920ad3286d1 100644 --- a/app/models/application_setting_implementation.rb +++ b/app/models/application_setting_implementation.rb @@ -42,6 +42,7 @@ module ApplicationSettingImplementation asset_proxy_enabled: false, authorized_keys_enabled: true, # TODO default to false if the instance is configured to use AuthorizedKeysCommand commit_email_hostname: default_commit_email_hostname, + container_expiration_policies_enable_historic_entries: false, container_registry_token_expire_delay: 5, default_artifacts_expire_in: '30 days', default_branch_protection: Settings.gitlab['default_branch_protection'], diff --git a/app/models/users_statistics.rb b/app/models/users_statistics.rb index 1a500717efd..37a430015e5 100644 --- a/app/models/users_statistics.rb +++ b/app/models/users_statistics.rb @@ -1,16 +1,29 @@ # frozen_string_literal: true class UsersStatistics < ApplicationRecord - STATISTICS_NAMES = [ - :without_groups_and_projects, - :with_highest_role_guest, - :with_highest_role_reporter, - :with_highest_role_developer, - :with_highest_role_maintainer, - :with_highest_role_owner, - :bots, - :blocked - ].freeze + scope :order_created_at_desc, -> { order(created_at: :desc) } + + class << self + def latest + order_created_at_desc.first + end + end + + def active + [ + without_groups_and_projects, + with_highest_role_guest, + with_highest_role_reporter, + with_highest_role_developer, + with_highest_role_maintainer, + with_highest_role_owner, + bots + ].sum + end + + def total + active + blocked + end class << self def create_current_stats! |