OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Pass the offset derived from a reply so that links are set correctly
Oliver Günther98b8b3ed9f94
diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rbindex 928b2e52003..e4e38719e4f 100644--- a/app/controllers/messages_controller.rb+++ b/app/controllers/messages_controller.rb@@ -42,18 +42,18 @@ class MessagesController < ApplicationControllerdef show@topic = @message.root- page = params[:page]+ @offset = params[:page]# Find the page of the requested reply- if params[:r] && page.nil?+ if params[:r] && @offset.nil?offset = @topic.children.where(["#{Message.table_name}.id < ?", params[:r].to_i]).count- page = 1 + (offset / REPLIES_PER_PAGE)+ @offset = 1 + (offset / REPLIES_PER_PAGE)end@replies = @topic.children.includes(:author, :attachments, forum: :project).order(created_at: :asc)- .page(page)+ .page(@offset).per_page(per_page_param)@reply = Message.new(subject: "RE: #{@message.subject}", parent: @topic, forum: @topic.forum)diff --git a/app/views/messages/show.html.erb b/app/views/messages/show.html.erbindex ad4f8d0fb03..d10435c26b4 100644--- a/app/views/messages/show.html.erb+++ b/app/views/messages/show.html.erb@@ -113,7 +113,7 @@ See COPYRIGHT and LICENSE files for more details.<%= avatar(message.author) %><%= link_to h(message.subject), topic_path(@topic,r: message,- page: params[:page] || 1,+ page: @offset,anchor: "message-#{message.id}") %>-<%= authoring message.created_at, message.author %>