Merge branch '34097-issue-board-remove-from-board-button-when-viewing-an-issue-gives-js-error-and-fails' into 'master'

Resolve "Issue Board -> "Remove from board" button when viewing an issue gives js error and fails"

Closes #34097

See merge request !12430
This commit is contained in:
Phil Hughes 2017-07-03 07:45:02 +00:00
commit 4eb6b7c137
5 changed files with 27 additions and 4 deletions

View File

@ -34,7 +34,10 @@ gl.issueBoards.BoardSidebar = Vue.extend({
},
milestoneTitle() {
return this.issue.milestone ? this.issue.milestone.title : 'No Milestone';
}
},
canRemove() {
return !this.list.preset;
},
},
watch: {
detail: {

View File

@ -46,8 +46,7 @@ gl.issueBoards.RemoveIssueBtn = Vue.extend({
},
template: `
<div
class="block list"
v-if="list.type !== 'closed'">
class="block list">
<button
class="btn btn-default btn-block"
type="button"

View File

@ -23,4 +23,5 @@
= render "projects/boards/components/sidebar/labels"
= render "projects/boards/components/sidebar/notifications"
%remove-btn{ ":issue" => "issue",
":list" => "list" }
":list" => "list",
"v-if" => "canRemove" }

View File

@ -0,0 +1,4 @@
---
title: Remove "Remove from board" button from backlog and closed list
merge_request: 12430
author:

View File

@ -79,6 +79,22 @@ describe 'Issue Boards', feature: true, js: true do
end
end
it 'does not show remove button for backlog or closed issues' do
create(:issue, project: project)
create(:issue, :closed, project: project)
visit namespace_project_board_path(project.namespace, project, board)
wait_for_requests
click_card(find('.board:nth-child(1)').first('.card'))
expect(find('.issue-boards-sidebar')).not_to have_button 'Remove from board'
click_card(find('.board:nth-child(3)').first('.card'))
expect(find('.issue-boards-sidebar')).not_to have_button 'Remove from board'
end
context 'assignee' do
it 'updates the issues assignee' do
click_card(card)