summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-11-16 16:14:19 +0100
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-11-16 16:14:19 +0100
commit929ab909c88e9ac5d87acacb376a39dcfa6a639c (patch)
tree20774e1c2ad483195c116bb1a7c8414c4ab8792f /app
parent78d542fcd811b6e18209fb97f126fd6291bd411b (diff)
downloadgitlab-ce-929ab909c88e9ac5d87acacb376a39dcfa6a639c.tar.gz
Group masters should be able to create/close milestones
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'app')
-rw-r--r--app/controllers/groups/milestones_controller.rb2
-rw-r--r--app/models/ability.rb1
-rw-r--r--app/views/groups/milestones/_milestone.html.haml2
-rw-r--r--app/views/groups/milestones/index.html.haml9
-rw-r--r--app/views/groups/milestones/show.html.haml2
5 files changed, 9 insertions, 7 deletions
diff --git a/app/controllers/groups/milestones_controller.rb b/app/controllers/groups/milestones_controller.rb
index 6833a550c9e..10233222ee1 100644
--- a/app/controllers/groups/milestones_controller.rb
+++ b/app/controllers/groups/milestones_controller.rb
@@ -38,7 +38,7 @@ class Groups::MilestonesController < Groups::ApplicationController
private
def authorize_group_milestone!
- return render_404 unless can?(current_user, :admin_group, group)
+ return render_404 unless can?(current_user, :admin_milestones, group)
end
def milestone_params
diff --git a/app/models/ability.rb b/app/models/ability.rb
index 5ae28d5133e..d01b3ae6f05 100644
--- a/app/models/ability.rb
+++ b/app/models/ability.rb
@@ -233,6 +233,7 @@ class Ability
if group.has_master?(user) || group.has_owner?(user) || user.admin?
rules.push(*[
:create_projects,
+ :admin_milestones
])
end
diff --git a/app/views/groups/milestones/_milestone.html.haml b/app/views/groups/milestones/_milestone.html.haml
index 41dffdd2fb8..a20bf75bc39 100644
--- a/app/views/groups/milestones/_milestone.html.haml
+++ b/app/views/groups/milestones/_milestone.html.haml
@@ -22,7 +22,7 @@
%span.label.label-gray
= milestone.project.name
.col-sm-6
- - if can?(current_user, :admin_group, @group)
+ - if can?(current_user, :admin_milestones, @group)
- if milestone.closed?
= link_to 'Reopen Milestone', group_milestone_path(@group, milestone.safe_title, title: milestone.title, milestone: {state_event: :activate }), method: :put, class: "btn btn-xs btn-grouped btn-reopen"
- else
diff --git a/app/views/groups/milestones/index.html.haml b/app/views/groups/milestones/index.html.haml
index ffd7dd3fc0b..84ec77c6188 100644
--- a/app/views/groups/milestones/index.html.haml
+++ b/app/views/groups/milestones/index.html.haml
@@ -3,10 +3,11 @@
= render 'shared/milestones_filter'
.gray-content-block
- .pull-right
- %span.pull-right.hidden-xs
- = link_to new_group_milestone_path(@group), class: "btn btn-new" do
- New Milestone
+ - if can?(current_user, :admin_milestones, @group)
+ .pull-right
+ %span.pull-right.hidden-xs
+ = link_to new_group_milestone_path(@group), class: "btn btn-new" do
+ New Milestone
.oneline
Only milestones from
diff --git a/app/views/groups/milestones/show.html.haml b/app/views/groups/milestones/show.html.haml
index e609abca08e..716e93f558b 100644
--- a/app/views/groups/milestones/show.html.haml
+++ b/app/views/groups/milestones/show.html.haml
@@ -9,7 +9,7 @@
Open
Milestone #{@milestone.title}
.pull-right
- - if can?(current_user, :admin_group, @group)
+ - if can?(current_user, :admin_milestones, @group)
- if @milestone.active?
= link_to 'Close Milestone', group_milestone_path(@group, @milestone.safe_title, title: @milestone.title, milestone: {state_event: :close }), method: :put, class: "btn btn-sm btn-close"
- else