Commit 117ccb89 authored by Jose Ivan Vargas's avatar Jose Ivan Vargas

Fix milestone delete button showing for all users

parent 5e8138aa
...@@ -56,13 +56,13 @@ ...@@ -56,13 +56,13 @@
= link_to 'Close Milestone', project_milestone_path(@project, milestone, milestone: {state_event: :close }), method: :put, remote: true, class: "btn btn-xs btn-close btn-grouped" = link_to 'Close Milestone', project_milestone_path(@project, milestone, milestone: {state_event: :close }), method: :put, remote: true, class: "btn btn-xs btn-close btn-grouped"
%button.js-delete-milestone-button.btn.btn-xs.btn-grouped.btn-danger{ data: { toggle: 'modal', %button.js-delete-milestone-button.btn.btn-xs.btn-grouped.btn-danger{ data: { toggle: 'modal',
target: '#delete-milestone-modal', target: '#delete-milestone-modal',
milestone_id: milestone.id, milestone_id: milestone.id,
milestone_title: markdown_field(milestone, :title), milestone_title: markdown_field(milestone, :title),
milestone_url: project_milestone_path(milestone.project, milestone), milestone_url: project_milestone_path(milestone.project, milestone),
milestone_issue_count: milestone.issues.count, milestone_issue_count: milestone.issues.count,
milestone_merge_request_count: milestone.merge_requests.count }, milestone_merge_request_count: milestone.merge_requests.count },
disabled: true } disabled: true }
= _('Delete') = _('Delete')
= icon('spin spinner', class: 'js-loading-icon hidden' ) = icon('spin spinner', class: 'js-loading-icon hidden' )
...@@ -97,4 +97,15 @@ feature 'Milestone' do ...@@ -97,4 +97,15 @@ feature 'Milestone' do
end end
end end
end end
feature 'Deleting a milestone' do
scenario "The delete milestone button does not show for unauthorized users" do
create(:milestone, project: project, title: 8.7)
sign_out(user)
visit group_milestones_path(group)
expect(page).to have_selector('.js-delete-milestone-button', count: 0)
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