Feature #22008

Associated Revision API

Added by anish kumar over 6 years ago. Updated over 1 year ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:Go MAEDA% Done:


Category:REST API
Target version:4.2.0


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

22008-add-api.patch Magnifier (7.26 KB) Yuichi HARADA, 2020-02-12 06:09

Related issues

Related to Redmine - Feature #35771: Document 'Repositories Management API' and 'Revisions Add... New

Associated revisions

Revision 20852
Added by Go MAEDA over 1 year ago

Associated Revision API (#22008).

Patch by Yuichi HARADA.

Revision 20853
Added by Go MAEDA over 1 year ago

Test for r20852 (#22008).

Patch by Yuichi HARADA.


#1 Updated by Yuichi HARADA over 2 years ago

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

-    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

@@ -239,6 +246,10 @@ class RepositoriesController < ApplicationController
     if @issue
+    respond_to do |format|
+      format.api { render_api_ok }
+      format.js
+    end

   def diff

#2 Updated by Go MAEDA over 2 years ago

  • Priority changed from High to Normal
  • Target version set to Candidate for next major release

#3 Updated by Go MAEDA over 2 years ago

The Ruby team also needs this feature. Thay applies a similar patch to https://bugs.ruby-lang.org/. See their repository for details.

#4 Updated by Go MAEDA over 2 years ago

  • Target version changed from Candidate for next major release to 4.2.0

Setting the target version to 4.2.0.

#5 Updated by Go MAEDA over 1 year ago

  • Status changed from New to Closed
  • Assignee set to Go MAEDA
  • Resolution set to Fixed

Committed the patch. Thank you for your contribution.

#6 Updated by Mischa The Evil 12 months ago

  • Related to Feature #35771: Document 'Repositories Management API' and 'Revisions Add/Delete Related Issues API' added

Also available in: Atom PDF