From 1a4ff9eb49f8108e1fcdbdcf70ed9c7db766dbb2 Mon Sep 17 00:00:00 2001 From: Go MAEDA Date: Sun, 2 Jun 2019 15:58:32 +0000 Subject: [PATCH] Send the journal_indice as param in order to get rid of extra queries (#31427). Patch by Marius BALTEANU. git-svn-id: http://svn.redmine.org/redmine/trunk@18218 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/controllers/journals_controller.rb | 3 +-- app/helpers/journals_helper.rb | 2 +- test/functional/journals_controller_test.rb | 3 ++- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/controllers/journals_controller.rb b/app/controllers/journals_controller.rb index a0a0352dd..7a477a0b1 100644 --- a/app/controllers/journals_controller.rb +++ b/app/controllers/journals_controller.rb @@ -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 diff --git a/app/helpers/journals_helper.rb b/app/helpers/journals_helper.rb index d6182bbbe..809afb4cc 100644 --- a/app/helpers/journals_helper.rb +++ b/app/helpers/journals_helper.rb @@ -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), diff --git a/test/functional/journals_controller_test.rb b/test/functional/journals_controller_test.rb index 6b4c65514..0acf2d966 100644 --- a/test/functional/journals_controller_test.rb +++ b/test/functional/journals_controller_test.rb @@ -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 -- 2.39.5