summaryrefslogtreecommitdiffstats
path: root/app/controllers/repositories_controller.rb
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2021-03-26 04:37:14 +0000
committerGo MAEDA <maeda@farend.jp>2021-03-26 04:37:14 +0000
commita4ee2963fbd509b7e16c8fce663d1b2bd63024d9 (patch)
treed3a5ccb39f5d88342d87231a5ec8acfe99179474 /app/controllers/repositories_controller.rb
parent919c9cfdd0a58491b248e28ff521911a1b383089 (diff)
downloadredmine-a4ee2963fbd509b7e16c8fce663d1b2bd63024d9.tar.gz
redmine-a4ee2963fbd509b7e16c8fce663d1b2bd63024d9.zip
Associated Revision API (#22008).
Patch by Yuichi HARADA. git-svn-id: http://svn.redmine.org/redmine/trunk@20852 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers/repositories_controller.rb')
-rw-r--r--app/controllers/repositories_controller.rb15
1 files changed, 13 insertions, 2 deletions
diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb
index caa6a29b4..73929c1df 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
@@ -233,8 +234,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
@@ -245,6 +252,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