Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-04-08 12:09:43 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-04-08 12:09:43 +0300
commitf5050253469fc0961c02deec0e698ad62bdd9de5 (patch)
tree30bbd8f8b556fd5b730f0123921138ee1d6bdaa2 /app/models
parentf6cdec670b9b757fc2225a2c6627ab79765e5b8a (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models')
-rw-r--r--app/models/application_setting.rb3
-rw-r--r--app/models/application_setting_implementation.rb1
-rw-r--r--app/models/users_statistics.rb33
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!