diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-09-29 00:10:21 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-09-29 00:10:21 +0300 |
commit | b27ec7e464fbdb37c2be961a856d6eb99caeb767 (patch) | |
tree | b6fefe378371292e2ffd1de6f47e241df3d4aa2c /app/models | |
parent | 46c019ae69759f91eb6e71e4aa4dd9b23b136f60 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/integrations/integration_list.rb | 29 | ||||
-rw-r--r-- | app/models/plan_limits.rb | 1 | ||||
-rw-r--r-- | app/models/project.rb | 1 | ||||
-rw-r--r-- | app/models/project_team.rb | 6 | ||||
-rw-r--r-- | app/models/service_list.rb | 27 |
5 files changed, 35 insertions, 29 deletions
diff --git a/app/models/integrations/integration_list.rb b/app/models/integrations/integration_list.rb new file mode 100644 index 00000000000..ab03e5c0e0a --- /dev/null +++ b/app/models/integrations/integration_list.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +module Integrations + class IntegrationList + def initialize(batch, integration_hash, association) + @batch = batch + @integration_hash = integration_hash + @association = association + end + + def to_array + [Integration, columns, values] + end + + private + + attr_reader :batch, :integration_hash, :association + + def columns + integration_hash.keys << "#{association}_id" + end + + def values + batch.select(:id).map do |record| + integration_hash.values << record.id + end + end + end +end diff --git a/app/models/plan_limits.rb b/app/models/plan_limits.rb index 245c0719439..478fc1c418a 100644 --- a/app/models/plan_limits.rb +++ b/app/models/plan_limits.rb @@ -7,7 +7,6 @@ class PlanLimits < ApplicationRecord ignore_column :ci_max_artifact_size_running_container_scanning, remove_with: '14.3', remove_after: '2021-08-22' ignore_column :web_hook_calls_high, remove_with: '15.10', remove_after: '2022-02-22' - ignore_column :ci_active_pipelines, remove_with: '16.3', remove_after: '2022-07-22' attribute :limits_history, :ind_jsonb, default: -> { {} } validates :limits_history, json_schema: { filename: 'plan_limits_history' } diff --git a/app/models/project.rb b/app/models/project.rb index 2934f295061..d614c96990e 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -3459,6 +3459,7 @@ class Project < ApplicationRecord # Issue for N+1: https://gitlab.com/gitlab-org/gitlab-foss/issues/49322 Gitlab::GitalyClient.allow_n_plus_1_calls do merge_requests_allowing_collaboration(branch_name).any? do |merge_request| + merge_request.author.can?(:push_code, self) && merge_request.can_be_merged_by?(user, skip_collaboration_check: true) end end diff --git a/app/models/project_team.rb b/app/models/project_team.rb index 34754f4fc95..38521ae6090 100644 --- a/app/models/project_team.rb +++ b/app/models/project_team.rb @@ -121,7 +121,7 @@ class ProjectTeam def import(source_project, current_user) target_project = project - source_members = source_project.project_members.to_a + source_members = source_members_for_import(source_project) target_user_ids = target_project.project_members.pluck_user_ids importer_access_level = max_member_access(current_user.id) @@ -242,6 +242,10 @@ class ProjectTeam def member_user_ids Member.on_project_and_ancestors(project).select(:user_id) end + + def source_members_for_import(source_project) + source_project.project_members.to_a + end end ProjectTeam.prepend_mod_with('ProjectTeam') diff --git a/app/models/service_list.rb b/app/models/service_list.rb deleted file mode 100644 index 8a52539d128..00000000000 --- a/app/models/service_list.rb +++ /dev/null @@ -1,27 +0,0 @@ -# frozen_string_literal: true - -class ServiceList - def initialize(batch, service_hash, association) - @batch = batch - @service_hash = service_hash - @association = association - end - - def to_array - [Integration, columns, values] - end - - private - - attr_reader :batch, :service_hash, :association - - def columns - service_hash.keys << "#{association}_id" - end - - def values - batch.select(:id).map do |record| - service_hash.values << record.id - end - end -end |