diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-09-24 21:06:18 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-09-24 21:06:18 +0000 |
commit | 150effab274651b3a8d2041e64ced734d1f3a349 (patch) | |
tree | 7f887964a56bd15a87d58cd367ccc1fa45f98554 /lib/gitlab | |
parent | 2ed368929ab5094fec5da8038f723463596a80cf (diff) | |
download | gitlab-ce-150effab274651b3a8d2041e64ced734d1f3a349.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab')
-rw-r--r-- | lib/gitlab/background_migration/update_vulnerability_confidence.rb | 35 | ||||
-rw-r--r-- | lib/gitlab/gl_repository/repo_type.rb | 2 | ||||
-rw-r--r-- | lib/gitlab/gon_helper.rb | 4 |
3 files changed, 41 insertions, 0 deletions
diff --git a/lib/gitlab/background_migration/update_vulnerability_confidence.rb b/lib/gitlab/background_migration/update_vulnerability_confidence.rb new file mode 100644 index 00000000000..f02f8151778 --- /dev/null +++ b/lib/gitlab/background_migration/update_vulnerability_confidence.rb @@ -0,0 +1,35 @@ +# frozen_string_literal: true +# rubocop:disable Style/Documentation +module Gitlab + module BackgroundMigration + class UpdateVulnerabilityConfidence + class Occurrence < ActiveRecord::Base + include ::EachBatch + + self.table_name = 'vulnerability_occurrences' + + REPORT_TYPES = { + container_scanning: 2 + }.freeze + + CONFIDENCE_LEVELS = { + unknown: 2, + medium: 5 + }.freeze + + enum confidences: CONFIDENCE_LEVELS + enum report_type: REPORT_TYPES + + def self.container_scanning_reports_with_medium_confidence + where(report_type: self.report_types[:container_scanning], confidence: self.confidences[:medium]) + end + end + + def perform(start_id, stop_id) + Occurrence.container_scanning_reports_with_medium_confidence + .where(id: start_id..stop_id) + .update_all(confidence: Occurrence.confidences[:unknown]) + end + end + end +end diff --git a/lib/gitlab/gl_repository/repo_type.rb b/lib/gitlab/gl_repository/repo_type.rb index 19915980d7f..01bc27f963b 100644 --- a/lib/gitlab/gl_repository/repo_type.rb +++ b/lib/gitlab/gl_repository/repo_type.rb @@ -40,3 +40,5 @@ module Gitlab end end end + +Gitlab::GlRepository::RepoType.prepend_if_ee('EE::Gitlab::GlRepository::RepoType') diff --git a/lib/gitlab/gon_helper.rb b/lib/gitlab/gon_helper.rb index 92917028851..2616a19fdaa 100644 --- a/lib/gitlab/gon_helper.rb +++ b/lib/gitlab/gon_helper.rb @@ -38,6 +38,10 @@ module Gitlab gon.current_user_fullname = current_user.name gon.current_user_avatar_url = current_user.avatar_url end + + # Initialize gon.features with any flags that should be + # made globally available to the frontend + push_frontend_feature_flag(:suppress_ajax_navigation_errors, default_enabled: true) end # Exposes the state of a feature flag to the frontend code. |