diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-30 18:09:15 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-30 18:09:15 +0300 |
commit | 536aa3a1f4b96abc4ca34489bf2cbe503afcded7 (patch) | |
tree | 88d08f7dfa29a32d6526773c4fe0fefd9f2bc7d1 /lib/gitlab | |
parent | 50ae4065530c4eafbeb7c5ff2c462c48c02947ca (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab')
-rw-r--r-- | lib/gitlab/background_migration/user_mentions/create_resource_user_mention.rb | 5 | ||||
-rw-r--r-- | lib/gitlab/background_migration/user_mentions/models/concerns/isolated_mentionable.rb (renamed from lib/gitlab/background_migration/user_mentions/models/isolated_mentionable.rb) | 0 | ||||
-rw-r--r-- | lib/gitlab/background_migration/user_mentions/models/concerns/mentionable_migration_methods.rb | 24 | ||||
-rw-r--r-- | lib/gitlab/background_migration/user_mentions/models/epic.rb | 1 | ||||
-rw-r--r-- | lib/gitlab/database/subquery.rb | 16 | ||||
-rw-r--r-- | lib/gitlab/jira/http_client.rb | 2 |
6 files changed, 27 insertions, 21 deletions
diff --git a/lib/gitlab/background_migration/user_mentions/create_resource_user_mention.rb b/lib/gitlab/background_migration/user_mentions/create_resource_user_mention.rb index e951b44b036..7d40dfbcdc4 100644 --- a/lib/gitlab/background_migration/user_mentions/create_resource_user_mention.rb +++ b/lib/gitlab/background_migration/user_mentions/create_resource_user_mention.rb @@ -24,14 +24,11 @@ module Gitlab mentions << record.build_mention_values end - no_quote_columns = [:note_id] - no_quote_columns << resource_user_mention_model.resource_foreign_key - Gitlab::Database.bulk_insert( resource_user_mention_model.table_name, mentions, return_ids: true, - disable_quote: no_quote_columns, + disable_quote: resource_model.no_quote_columns, on_conflict: :do_nothing ) end diff --git a/lib/gitlab/background_migration/user_mentions/models/isolated_mentionable.rb b/lib/gitlab/background_migration/user_mentions/models/concerns/isolated_mentionable.rb index 40aab896212..40aab896212 100644 --- a/lib/gitlab/background_migration/user_mentions/models/isolated_mentionable.rb +++ b/lib/gitlab/background_migration/user_mentions/models/concerns/isolated_mentionable.rb diff --git a/lib/gitlab/background_migration/user_mentions/models/concerns/mentionable_migration_methods.rb b/lib/gitlab/background_migration/user_mentions/models/concerns/mentionable_migration_methods.rb new file mode 100644 index 00000000000..fa479cb0ed3 --- /dev/null +++ b/lib/gitlab/background_migration/user_mentions/models/concerns/mentionable_migration_methods.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +module Gitlab + module BackgroundMigration + module UserMentions + module Models + # Extract common no_quote_columns method used in determining the columns that do not need + # to be quoted for corresponding models + module MentionableMigrationMethods + extend ::ActiveSupport::Concern + + class_methods do + def no_quote_columns + [ + :note_id, + user_mention_model.resource_foreign_key + ] + end + end + end + end + end + end +end diff --git a/lib/gitlab/background_migration/user_mentions/models/epic.rb b/lib/gitlab/background_migration/user_mentions/models/epic.rb index 019d8f0ea8b..9797c86478e 100644 --- a/lib/gitlab/background_migration/user_mentions/models/epic.rb +++ b/lib/gitlab/background_migration/user_mentions/models/epic.rb @@ -8,6 +8,7 @@ module Gitlab class Epic < ActiveRecord::Base include IsolatedMentionable include CacheMarkdownField + include MentionableMigrationMethods attr_mentionable :title, pipeline: :single_line attr_mentionable :description diff --git a/lib/gitlab/database/subquery.rb b/lib/gitlab/database/subquery.rb deleted file mode 100644 index 2a6f39c6a27..00000000000 --- a/lib/gitlab/database/subquery.rb +++ /dev/null @@ -1,16 +0,0 @@ -# frozen_string_literal: true - -module Gitlab - module Database - module Subquery - class << self - def self_join(relation) - t = relation.arel_table - t2 = relation.arel.as('t2') - - relation.unscoped.joins(t.join(t2).on(t[:id].eq(t2[:id])).join_sources.first) - end - end - end - end -end diff --git a/lib/gitlab/jira/http_client.rb b/lib/gitlab/jira/http_client.rb index 0c8b509740c..c09d8170d17 100644 --- a/lib/gitlab/jira/http_client.rb +++ b/lib/gitlab/jira/http_client.rb @@ -12,7 +12,7 @@ module Gitlab def request(*args) result = make_request(*args) - raise JIRA::HTTPError.new(result) unless result.response.is_a?(Net::HTTPSuccess) + raise JIRA::HTTPError.new(result.response) unless result.response.is_a?(Net::HTTPSuccess) result end |