diff --git a/app/controllers/forum_topics_controller.rb b/app/controllers/forum_topics_controller.rb index 404ed6a22..9aef4ea80 100644 --- a/app/controllers/forum_topics_controller.rb +++ b/app/controllers/forum_topics_controller.rb @@ -37,7 +37,6 @@ class ForumTopicsController < ApplicationController end @forum_posts = ForumPost.search(:topic_id => @forum_topic.id).reorder("forum_posts.id").paginate(params[:page]) @forum_posts = @forum_posts.reverse_order.includes(:creator).load if request.format.atom? - @original_forum_post_id = @forum_topic.original_post.id respond_with(@forum_topic) end diff --git a/app/views/forum_topics/show.html.erb b/app/views/forum_topics/show.html.erb index 5bab6d482..77dd8634c 100644 --- a/app/views/forum_topics/show.html.erb +++ b/app/views/forum_topics/show.html.erb @@ -20,7 +20,7 @@ <% end %> - <%= render "forum_posts/listing", forum_posts: @forum_posts, original_forum_post_id: @forum_topic.original_post.id, dtext_data: DText.preprocess(@forum_posts.map(&:body)), moderation_reports: @forum_topic.viewable_moderation_reports %> + <%= render "forum_posts/listing", forum_posts: @forum_posts, original_forum_post_id: @forum_topic.original_post&.id, dtext_data: DText.preprocess(@forum_posts.map(&:body)), moderation_reports: @forum_topic.viewable_moderation_reports %> <% if CurrentUser.is_member? %> <% if CurrentUser.is_moderator? || !@forum_topic.is_locked? %>