]> source.dussan.org Git - redmine.git/commitdiff
Send the journal_indice as param in order to get rid of extra queries (#31427).
authorGo MAEDA <maeda@farend.jp>
Sun, 2 Jun 2019 15:58:32 +0000 (15:58 +0000)
committerGo MAEDA <maeda@farend.jp>
Sun, 2 Jun 2019 15:58:32 +0000 (15:58 +0000)
Patch by Marius BALTEANU.

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

app/controllers/journals_controller.rb
app/helpers/journals_helper.rb
test/functional/journals_controller_test.rb

index a0a0352dde661f581a5d4287b6e4f450534eca62..7a477a0b14a35c38149caa91d357b4350324d482 100644 (file)
@@ -66,8 +66,7 @@ class JournalsController < ApplicationController
     if @journal
       user = @journal.user
       text = @journal.notes
-      indice = @journal.issue.visible_journals_with_index.find{|j| j.id == @journal.id}.indice
-      @content = +"#{ll(Setting.default_language, :text_user_wrote_in, {:value => user, :link => "#note-#{indice}"})}\n> "
+      @content = +"#{ll(Setting.default_language, :text_user_wrote_in, {:value => user, :link => "#note-#{params[:journal_indice]}"})}\n> "
     else
       user = @issue.author
       text = @issue.description
index d6182bbbe9e63844608f225626b8d758997d7dcb..809afb4cce39ab05f470ad412c6ede2d4028aae2 100644 (file)
@@ -31,7 +31,7 @@ module JournalsHelper
     if journal.notes.present?
       if options[:reply_links]
         links << link_to(l(:button_quote),
-                         quoted_issue_path(issue, :journal_id => journal),
+                         quoted_issue_path(issue, :journal_id => journal, :journal_indice => journal.indice),
                          :remote => true,
                          :method => 'post',
                          :title => l(:button_quote),
index 6b4c65514ba7de9de202c9afabb29467ce76ee78..0acf2d96657ffc2f44de6dea113754e00ccad483 100644 (file)
@@ -180,7 +180,8 @@ class JournalsControllerTest < Redmine::ControllerTest
     @request.session[:user_id] = 2
     get :new, :params => {
         :id => 6,
-        :journal_id => 4
+        :journal_id => 4,
+        :journal_indice => 1
       },
       :xhr => true
     assert_response :success