]> source.dussan.org Git - redmine.git/commitdiff
Don't load changesets when IssuesController#show processes API requests without ...
authorGo MAEDA <maeda@farend.jp>
Sun, 31 Jul 2022 13:00:25 +0000 (13:00 +0000)
committerGo MAEDA <maeda@farend.jp>
Sun, 31 Jul 2022 13:00:25 +0000 (13:00 +0000)
Patch by Go MAEDA.

git-svn-id: https://svn.redmine.org/redmine/trunk@21746 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/controllers/issues_controller.rb

index 056d309e90bbc119751e2d075ab8db77de30c968..5d67cd8ccb38a209f21d04be0a0f34807db31d68 100644 (file)
@@ -94,7 +94,7 @@ class IssuesController < ApplicationController
 
   def show
     @journals = @issue.visible_journals_with_index
-    @has_changesets = @issue.changesets.visible.preload(:repository, :user).exists?
+    @has_changesets = @issue.changesets.visible.preload(:repository, :user).exists? unless api_request?
     @relations =
       @issue.relations.
         select do |r|
@@ -119,8 +119,10 @@ class IssuesController < ApplicationController
       end
       format.api do
         @allowed_statuses = @issue.new_statuses_allowed_to(User.current)
-        @changesets = @issue.changesets.visible.preload(:repository, :user).to_a
-        @changesets.reverse! if User.current.wants_comments_in_reverse_order?
+        if include_in_api_response?('changesets')
+          @changesets = @issue.changesets.visible.preload(:repository, :user).to_a
+          @changesets.reverse! if User.current.wants_comments_in_reverse_order?
+        end
       end
       format.atom do
         render :template => 'journals/index', :layout => false,