diff options
author | Rémy Coutable <remy@rymai.me> | 2019-03-26 21:54:20 +0000 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2019-03-26 21:54:20 +0000 |
commit | 81fe9e9b2e670cc7dcd9405e336f72cabc5a14ba (patch) | |
tree | a55e4f6a564e17da86a7baeb12f100420a31f182 | |
parent | b0a873aae627accd604fbc50db9d2c89f6b87dbe (diff) | |
parent | d97d35d3da48493189c3c0017198b19d3f91cf9a (diff) | |
download | gitlab-ce-81fe9e9b2e670cc7dcd9405e336f72cabc5a14ba.tar.gz |
Merge branch '49910-reopening-a-closed-milestone-from-the-closed-milestones-page-fails2' into 'master'
Fix bug when reopening milestone from index page
Closes #49910
See merge request gitlab-org/gitlab-ce!26597
3 files changed, 34 insertions, 1 deletions
diff --git a/app/views/shared/milestones/_milestone.html.haml b/app/views/shared/milestones/_milestone.html.haml index e75f0a184ea..e99aa3f1ee4 100644 --- a/app/views/shared/milestones/_milestone.html.haml +++ b/app/views/shared/milestones/_milestone.html.haml @@ -52,7 +52,7 @@ = link_to 'Close Milestone', project_milestone_path(@project, milestone, milestone: {state_event: :close }), method: :put, remote: true, class: "btn btn-sm btn-close btn-grouped" - unless milestone.active? - = link_to 'Reopen Milestone', project_milestone_path(@project, milestone, {state_event: :activate }), method: :put, class: "btn btn-grouped btn-reopen" + = link_to 'Reopen Milestone', project_milestone_path(@project, milestone, milestone: {state_event: :activate }), method: :put, class: "btn btn-grouped btn-reopen" - if @group - if can?(current_user, :admin_milestone, @group) - if milestone.closed? diff --git a/changelogs/unreleased/49910-reopening-a-closed-milestone-from-the-closed-milestones-page-fails2.yml b/changelogs/unreleased/49910-reopening-a-closed-milestone-from-the-closed-milestones-page-fails2.yml new file mode 100644 index 00000000000..68d38cd56c5 --- /dev/null +++ b/changelogs/unreleased/49910-reopening-a-closed-milestone-from-the-closed-milestones-page-fails2.yml @@ -0,0 +1,5 @@ +--- +title: Fix bug when reopening milestone from index page +merge_request: +author: +type: fixed diff --git a/spec/features/milestone_spec.rb b/spec/features/milestone_spec.rb index 6e349395017..adac59b89ef 100644 --- a/spec/features/milestone_spec.rb +++ b/spec/features/milestone_spec.rb @@ -122,4 +122,32 @@ describe 'Milestone' do expect(page).to have_selector('.popover') end end + + describe 'reopen closed milestones' do + before do + create(:milestone, :closed, project: project) + end + + describe 'group milestones page' do + it 'reopens the milestone' do + visit group_milestones_path(group, { state: 'closed' }) + + click_link 'Reopen Milestone' + + expect(page).not_to have_selector('.status-box-closed') + expect(page).to have_selector('.status-box-open') + end + end + + describe 'project milestones page' do + it 'reopens the milestone' do + visit project_milestones_path(project, { state: 'closed' }) + + click_link 'Reopen Milestone' + + expect(page).not_to have_selector('.status-box-closed') + expect(page).to have_selector('.status-box-open') + end + end + end end |