From 16fd0a106b79b131ce366a59fe27b8f2ce81913e Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Tue, 17 Jun 2014 23:48:22 +0400 Subject: [PATCH] Added ability to local_writer to merge/update PullRequest --- app/models/ability.rb | 4 ++-- spec/controllers/projects/pull_requests_controller_spec.rb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/models/ability.rb b/app/models/ability.rb index 4c33f0534..3f9f09a8e 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -154,8 +154,8 @@ class Ability can [:read, :commits, :files], PullRequest, to_project: {owner_type: 'Group', owner_id: user_group_ids} can([:read, :commits, :files], PullRequest, read_relations_for('pull_requests', 'to_projects')) {|pull| can? :read, pull.to_project} can :create, PullRequest - can(:update, PullRequest) {|pull| pull.user_id == user.id or local_admin?(pull.to_project)} - can(:merge, PullRequest) {|pull| local_admin?(pull.to_project)} + can(:update, PullRequest) {|pull| pull.user_id == user.id or local_writer?(pull.to_project)} + can(:merge, PullRequest) {|pull| local_writer?(pull.to_project)} can([:create, :new_line], Comment) {|comment| can? :read, comment.project} can([:update, :destroy], Comment) {|comment| comment.user == user or comment.project.owner == user or local_admin?(comment.project)} diff --git a/spec/controllers/projects/pull_requests_controller_spec.rb b/spec/controllers/projects/pull_requests_controller_spec.rb index eef8119da..079c5645e 100644 --- a/spec/controllers/projects/pull_requests_controller_spec.rb +++ b/spec/controllers/projects/pull_requests_controller_spec.rb @@ -151,7 +151,7 @@ shared_examples_for 'user without pull request update rights' do pull.issue.body.should_not =='updating' end - it 'should be able to perform merge action' do + it 'should not be able to perform merge action' do @pull.check put :merge, @update_params response.should_not be_success @@ -239,7 +239,7 @@ describe Projects::PullRequestsController do it_should_behave_like 'pull request user with project guest rights' it_should_behave_like 'pull request user with project reader rights' - it_should_behave_like 'user without pull request update rights' + it_should_behave_like 'user with pull request update rights' it_should_behave_like 'pull request when project with issues turned off' end