Feature #22008
Associated Revision API
Status: | New | Start date: | ||
---|---|---|---|---|
Priority: | Normal | Due date: | ||
Assignee: | - | % Done: | 0% | |
Category: | REST API | |||
Target version: | 4.2.0 | |||
Resolution: |
Description
Hi I need to check the commit details for specific issue, where we check these through Associated revision is it possible to do it through api
History
#1
Updated by Yuichi HARADA 11 months ago
- File 22008-add-api.patch
added
Created an API to add/remove related issues to the revision. I attached a patch.
diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb
index 269bc70a0..92a145c3a 100644
--- a/app/controllers/repositories_controller.rb
+++ b/app/controllers/repositories_controller.rb
@@ -35,6 +35,7 @@ class RepositoriesController < ApplicationController
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
@@ -227,8 +228,14 @@ class RepositoriesController < ApplicationController
@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
@@ -239,6 +246,10 @@ class RepositoriesController < ApplicationController
if @issue
@changeset.issues.delete(@issue)
end
+ respond_to do |format|
+ format.api { render_api_ok }
+ format.js
+ end
end
def diff
#3
Updated by Go MAEDA 11 months ago
The Ruby team also needs this feature. Thay applies a similar patch to https://bugs.ruby-lang.org/. See their repository for details.