diff options
author | Eugenia Grieff <egrieff@gitlab.com> | 2019-08-08 09:25:20 +0300 |
---|---|---|
committer | Mike Greiling <mike@pixelcog.com> | 2019-08-08 09:25:20 +0300 |
commit | 01950c3944738b918666230b7d36304cd17ce823 (patch) | |
tree | da80aac2ece4cd304e043f3e70a9b7dcf90d013d /app | |
parent | 3ad34c3a243cda19e73fbda0c9682e0a1c16c10a (diff) |
CE port for bulk updating group labels
- Original EE MR: https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/14827
Diffstat (limited to 'app')
-rw-r--r-- | app/models/issue.rb | 1 | ||||
-rw-r--r-- | app/models/merge_request.rb | 1 | ||||
-rw-r--r-- | app/services/issuable/bulk_update_service.rb | 2 | ||||
-rw-r--r-- | app/views/groups/issues.html.haml | 2 | ||||
-rw-r--r-- | app/views/groups/merge_requests.html.haml | 2 | ||||
-rw-r--r-- | app/views/shared/issuable/_label_dropdown.html.haml | 3 |
6 files changed, 7 insertions, 4 deletions
diff --git a/app/models/issue.rb b/app/models/issue.rb index 164858dc432..bc5ec94081b 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -43,6 +43,7 @@ class Issue < ApplicationRecord validates :project, presence: true alias_attribute :parent_ids, :project_id + alias_method :issuing_parent, :project scope :in_projects, ->(project_ids) { where(project_id: project_ids) } diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb index 5e8a6a7d5e5..4c4883fc022 100644 --- a/app/models/merge_request.rb +++ b/app/models/merge_request.rb @@ -192,6 +192,7 @@ class MergeRequest < ApplicationRecord alias_attribute :project, :target_project alias_attribute :project_id, :target_project_id alias_attribute :auto_merge_enabled, :merge_when_pipeline_succeeds + alias_method :issuing_parent, :target_project def self.reference_prefix '!' diff --git a/app/services/issuable/bulk_update_service.rb b/app/services/issuable/bulk_update_service.rb index 6d215d7a3b9..273a12f386a 100644 --- a/app/services/issuable/bulk_update_service.rb +++ b/app/services/issuable/bulk_update_service.rb @@ -29,7 +29,7 @@ module Issuable items.each do |issuable| next unless can?(current_user, :"update_#{type}", issuable) - update_class.new(issuable.project, current_user, params).execute(issuable) + update_class.new(issuable.issuing_parent, current_user, params).execute(issuable) end { diff --git a/app/views/groups/issues.html.haml b/app/views/groups/issues.html.haml index 2163446425c..bf077eb09d2 100644 --- a/app/views/groups/issues.html.haml +++ b/app/views/groups/issues.html.haml @@ -1,4 +1,4 @@ -- @can_bulk_update = can?(current_user, :admin_issue, @group) +- @can_bulk_update = can?(current_user, :admin_issue, @group) && @group.feature_available?(:group_bulk_edit) - page_title "Issues" = content_for :meta_tags do diff --git a/app/views/groups/merge_requests.html.haml b/app/views/groups/merge_requests.html.haml index b5a2bab4799..0780fab513b 100644 --- a/app/views/groups/merge_requests.html.haml +++ b/app/views/groups/merge_requests.html.haml @@ -1,4 +1,4 @@ -- @can_bulk_update = can?(current_user, :admin_merge_request, @group) +- @can_bulk_update = can?(current_user, :admin_merge_request, @group) && @group.feature_available?(:group_bulk_edit) - page_title "Merge Requests" diff --git a/app/views/shared/issuable/_label_dropdown.html.haml b/app/views/shared/issuable/_label_dropdown.html.haml index 483652852b6..bca5db16bd3 100644 --- a/app/views/shared/issuable/_label_dropdown.html.haml +++ b/app/views/shared/issuable/_label_dropdown.html.haml @@ -1,4 +1,5 @@ - project = @target_project || @project +- edit_context = local_assigns.fetch(:edit_context, nil) || project - show_create = local_assigns.fetch(:show_create, true) - extra_options = local_assigns.fetch(:extra_options, true) - filter_submit = local_assigns.fetch(:filter_submit, true) @@ -8,7 +9,7 @@ - classes = local_assigns.fetch(:classes, []) - selected = local_assigns.fetch(:selected, nil) - dropdown_title = local_assigns.fetch(:dropdown_title, "Filter by label") -- dropdown_data = label_dropdown_data(@project, labels: labels_filter_path_with_defaults, default_label: "Labels") +- dropdown_data = label_dropdown_data(edit_context, labels: labels_filter_path_with_defaults(only_group_labels: edit_context.is_a?(Group)), default_label: "Labels") - dropdown_data.merge!(data_options) - label_name = local_assigns.fetch(:label_name, "Labels") - no_default_styles = local_assigns.fetch(:no_default_styles, false) |