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-10-21 10:08:36 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-10-21 10:08:36 +0300
commit48aff82709769b098321c738f3444b9bdaa694c6 (patch)
treee00c7c43e2d9b603a5a6af576b1685e400410dee /app/models/application_setting.rb
parent879f5329ee916a948223f8f43d77fba4da6cd028 (diff)
Add latest changes from gitlab-org/gitlab@13-5-stable-eev13.5.0-rc42
Diffstat (limited to 'app/models/application_setting.rb')
-rw-r--r--app/models/application_setting.rb16
1 files changed, 15 insertions, 1 deletions
diff --git a/app/models/application_setting.rb b/app/models/application_setting.rb
index e9a3dcf39df..d034630a085 100644
--- a/app/models/application_setting.rb
+++ b/app/models/application_setting.rb
@@ -11,6 +11,7 @@ class ApplicationSetting < ApplicationRecord
ignore_column :instance_statistics_visibility_private, remove_with: '13.6', remove_after: '2020-10-22'
ignore_column :snowplow_iglu_registry_url, remove_with: '13.6', remove_after: '2020-11-22'
+ INSTANCE_REVIEW_MIN_USERS = 50
GRAFANA_URL_ERROR_MESSAGE = 'Please check your Grafana URL setting in ' \
'Admin Area > Settings > Metrics and profiling > Metrics - Grafana'
@@ -91,11 +92,16 @@ class ApplicationSetting < ApplicationRecord
addressable_url: true,
if: :help_page_support_url_column_exists?
+ validates :help_page_documentation_base_url,
+ length: { maximum: 255, message: _("is too long (maximum is %{count} characters)") },
+ allow_blank: true,
+ addressable_url: true
+
validates :after_sign_out_path,
allow_blank: true,
addressable_url: true
- validates :admin_notification_email,
+ validates :abuse_notification_email,
devise_email: true,
allow_blank: true
@@ -432,6 +438,14 @@ class ApplicationSetting < ApplicationRecord
!!(sourcegraph_url =~ /\Ahttps:\/\/(www\.)?sourcegraph\.com/)
end
+ def instance_review_permitted?
+ users_count = Rails.cache.fetch('limited_users_count', expires_in: 1.day) do
+ ::User.limit(INSTANCE_REVIEW_MIN_USERS + 1).count(:all)
+ end
+
+ users_count >= INSTANCE_REVIEW_MIN_USERS
+ end
+
def self.create_from_defaults
check_schema!