summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-07-23 18:27:09 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-07-23 18:27:09 +0000
commitbcc70301531b6c3118120173389f2aaa7452bf11 (patch)
tree161f1ee56e15ec9e59f48c5e1a9cb86b62469a49 /lib
parentd47fc5085a706ab37d038636c9d5934da69853f0 (diff)
downloadgitlab-ce-bcc70301531b6c3118120173389f2aaa7452bf11.tar.gz
Add latest changes from gitlab-org/gitlab@13-2-stable-ee
Diffstat (limited to 'lib')
-rw-r--r--lib/api/entities/merge_request_approvals.rb3
-rw-r--r--lib/assets/images/bot_avatars/alert-bot.pngbin0 -> 9362 bytes
-rw-r--r--lib/assets/images/bot_avatars/security-bot.pngbin0 -> 9561 bytes
-rw-r--r--lib/assets/images/bot_avatars/support-bot.pngbin0 -> 9806 bytes
-rw-r--r--lib/gitlab/config_checker/external_database_checker.rb2
-rw-r--r--lib/gitlab/database.rb18
6 files changed, 19 insertions, 4 deletions
diff --git a/lib/api/entities/merge_request_approvals.rb b/lib/api/entities/merge_request_approvals.rb
index e3d58d687c4..0c464844ae7 100644
--- a/lib/api/entities/merge_request_approvals.rb
+++ b/lib/api/entities/merge_request_approvals.rb
@@ -8,8 +8,7 @@ module API
end
expose :user_can_approve do |merge_request, options|
- !merge_request.approved_by?(options[:current_user]) &&
- options[:current_user].can?(:approve_merge_request, merge_request)
+ merge_request.can_be_approved_by?(options[:current_user])
end
expose :approved do |merge_request|
diff --git a/lib/assets/images/bot_avatars/alert-bot.png b/lib/assets/images/bot_avatars/alert-bot.png
new file mode 100644
index 00000000000..985d67d6179
--- /dev/null
+++ b/lib/assets/images/bot_avatars/alert-bot.png
Binary files differ
diff --git a/lib/assets/images/bot_avatars/security-bot.png b/lib/assets/images/bot_avatars/security-bot.png
new file mode 100644
index 00000000000..0709f62f07b
--- /dev/null
+++ b/lib/assets/images/bot_avatars/security-bot.png
Binary files differ
diff --git a/lib/assets/images/bot_avatars/support-bot.png b/lib/assets/images/bot_avatars/support-bot.png
new file mode 100644
index 00000000000..1335205c191
--- /dev/null
+++ b/lib/assets/images/bot_avatars/support-bot.png
Binary files differ
diff --git a/lib/gitlab/config_checker/external_database_checker.rb b/lib/gitlab/config_checker/external_database_checker.rb
index c08dd0351f3..af828acb9c0 100644
--- a/lib/gitlab/config_checker/external_database_checker.rb
+++ b/lib/gitlab/config_checker/external_database_checker.rb
@@ -23,7 +23,7 @@ module Gitlab
}
end
- if Gitlab::Database.postgresql_upcoming_deprecation?
+ if Gitlab::Database.postgresql_upcoming_deprecation? && Gitlab::Database.within_deprecation_notice_window?
upcoming_deprecation = Gitlab::Database::UPCOMING_POSTGRES_VERSION_DETAILS
notices <<
diff --git a/lib/gitlab/database.rb b/lib/gitlab/database.rb
index 2bfb6c32886..d88ca6d7fe3 100644
--- a/lib/gitlab/database.rb
+++ b/lib/gitlab/database.rb
@@ -13,11 +13,15 @@ module Gitlab
# so administrators can prepare to upgrade
UPCOMING_POSTGRES_VERSION_DETAILS = {
gl_version: '13.6.0',
- gl_version_date: 'November 2020',
+ gl_version_date: 'November 22, 2020',
pg_version_minimum: 12,
url: 'https://gitlab.com/groups/gitlab-org/-/epics/2374'
}.freeze
+ # Specifies the maximum number of days in advance to display a notice
+ # regarding an upcoming PostgreSQL version deprecation.
+ DEPRECATION_WINDOW_DAYS = 90
+
# https://www.postgresql.org/docs/9.2/static/datatype-numeric.html
MAX_INT_VALUE = 2147483647
@@ -119,6 +123,18 @@ module Gitlab
version.to_f < UPCOMING_POSTGRES_VERSION_DETAILS[:pg_version_minimum]
end
+ def self.days_until_deprecation
+ (
+ Date.parse(UPCOMING_POSTGRES_VERSION_DETAILS[:gl_version_date]) -
+ Date.today
+ ).to_i
+ end
+ private_class_method :days_until_deprecation
+
+ def self.within_deprecation_notice_window?
+ days_until_deprecation <= DEPRECATION_WINDOW_DAYS
+ end
+
def self.check_postgres_version_and_print_warning
return if Gitlab::Database.postgresql_minimum_supported_version?
return if Gitlab::Runtime.rails_runner?