Commit af87e40a authored by Chantal Rollison's avatar Chantal Rollison

Fixed label removal from issue

parent 74b5dce4
...@@ -41,8 +41,8 @@ class Label < ActiveRecord::Base ...@@ -41,8 +41,8 @@ class Label < ActiveRecord::Base
scope :templates, -> { where(template: true) } scope :templates, -> { where(template: true) }
scope :with_title, ->(title) { where(title: title) } scope :with_title, ->(title) { where(title: title) }
scope :with_lists_and_board, -> { joins(lists: :board).merge(List.movable) } scope :with_lists_and_board, -> { joins(lists: :board).merge(List.movable) }
scope :on_group_boards, ->(group_id) { with_lists_and_board.where(boards: { group_id: group_id }) }
scope :on_project_boards, ->(project_id) { with_lists_and_board.where(boards: { project_id: project_id }) } scope :on_project_boards, ->(project_id) { with_lists_and_board.where(boards: { project_id: project_id }) }
scope :on_board, ->(board_id) { with_lists_and_board.where(boards: { id: board_id }) }
scope :order_name_asc, -> { reorder(title: :asc) } scope :order_name_asc, -> { reorder(title: :asc) }
scope :order_name_desc, -> { reorder(title: :desc) } scope :order_name_desc, -> { reorder(title: :desc) }
scope :subscribed_by, ->(user_id) { joins(:subscriptions).where(subscriptions: { user_id: user_id, subscribed: true }) } scope :subscribed_by, ->(user_id) { joins(:subscriptions).where(subscriptions: { user_id: user_id, subscribed: true }) }
......
...@@ -70,10 +70,8 @@ module Boards ...@@ -70,10 +70,8 @@ module Boards
label_ids = label_ids =
if moving_to_list.movable? if moving_to_list.movable?
moving_from_list.label_id moving_from_list.label_id
elsif board.group_board?
::Label.on_group_boards(parent.id).pluck(:label_id)
else else
::Label.on_project_boards(parent.id).pluck(:label_id) ::Label.on_board(board.id).pluck(:label_id)
end end
Array(label_ids).compact Array(label_ids).compact
......
---
title: Fixed label removal from issue
merge_request: 22762
author:
type: fixed
...@@ -34,7 +34,7 @@ shared_examples 'issues move service' do |group| ...@@ -34,7 +34,7 @@ shared_examples 'issues move service' do |group|
described_class.new(parent, user, params).execute(issue) described_class.new(parent, user, params).execute(issue)
issue.reload issue.reload
expect(issue.labels).to contain_exactly(bug) expect(issue.labels).to contain_exactly(bug, regression)
expect(issue).to be_closed expect(issue).to be_closed
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment