before_action :find_changeset, :only => [:revision, :add_related_issue, :remove_related_issue]
before_action :authorize
accept_rss_auth :revisions
+ accept_api_auth :add_related_issue, :remove_related_issue
rescue_from Redmine::Scm::Adapters::CommandFailed, :with => :show_error_command_failed
@issue = nil
end
- if @issue
- @changeset.issues << @issue
+ respond_to do |format|
+ if @issue
+ @changeset.issues << @issue
+ format.api { render_api_ok }
+ else
+ format.api { render_api_errors "#{l(:label_issue)} #{l('activerecord.errors.messages.invalid')}" }
+ end
+ format.js
end
end
if @issue
@changeset.issues.delete(@issue)
end
+ respond_to do |format|
+ format.api { render_api_ok }
+ format.js
+ end
end
def diff
should_route 'GET /queries' => 'queries#index'
end
+ def test_repositories
+ should_route 'POST /projects/1/repository/2/revisions/3/issues' => 'repositories#add_related_issue', :id => '1', :repository_id => '2', :rev => '3'
+ should_route 'DELETE /projects/1/repository/2/revisions/3/issues/4' => 'repositories#remove_related_issue', :id => '1', :repository_id => '2', :rev => '3', :issue_id => '4'
+ end
+
def test_roles
should_route 'GET /roles' => 'roles#index'
should_route 'GET /roles/2' => 'roles#show', :id => '2'