#214: updated PullRequest API

This commit is contained in:
Vokhmin Alexey V 2013-07-13 00:17:42 +04:00
parent fe8e1216c5
commit 1c57483434
2 changed files with 4 additions and 4 deletions

View File

@ -75,9 +75,9 @@ class Api::V1::PullRequestsController < Api::V1::BaseController
attrs.merge(:assignee_id => pull_params[:assignee_id]) if can?(:write, @project)
if (action = pull_params[:status]) && %w(close reopen).include?(pull_params[:status])
if @pull.valid? && @pull.send("can_#{action}?")
if @pull.send("can_#{action}?")
@pull.set_user_and_time current_user
need_check = true if action == 'reopen'
need_check = true if action == 'reopen' && @pull.valid?
end
end
end

View File

@ -2,14 +2,14 @@ json.number pull.serial_id
json.(pull, :title, :status)
json.to_ref do |json_ref|
json_ref.ref pull.to_ref
json_ref.sha pull.to_commit.id
json_ref.sha pull.to_commit.try(:id)
json_ref.project do |json_project|
json_project.partial! 'api/v1/projects/project', :project => pull.to_project, :json => json
end
end
json.from_ref do |json_ref|
json_ref.ref pull.from_ref
json_ref.sha pull.from_commit.id
json_ref.sha pull.from_commit.try(:id)
json_ref.project do |json_project|
json_project.partial! 'api/v1/projects/project', :project => pull.from_project, :json => json
end