diff --git a/app/controllers/forum_topics_controller.rb b/app/controllers/forum_topics_controller.rb index 01ea84765..c9cc1827e 100644 --- a/app/controllers/forum_topics_controller.rb +++ b/app/controllers/forum_topics_controller.rb @@ -26,6 +26,7 @@ class ForumTopicsController < ApplicationController def show @forum_topic = ForumTopic.find(params[:id]) @forum_posts = ForumPost.search(:topic_id => @forum_topic.id).order("forum_posts.id").paginate(params[:page]) + @forum_posts.all respond_with(@forum_topic) end diff --git a/app/models/forum_post.rb b/app/models/forum_post.rb index d7ffe2596..730fb72fd 100644 --- a/app/models/forum_post.rb +++ b/app/models/forum_post.rb @@ -118,6 +118,10 @@ class ForumPost < ActiveRecord::Base ((ForumPost.where("topic_id = ? and created_at <= ?", topic_id, created_at).count) / Danbooru.config.posts_per_page.to_f).ceil end + def is_original_post? + ForumPost.exists?(["id = ? and id = (select _.id from forum_posts _ where _.topic_id = ? order by _.id asc limit 1)", id, topic_id]) + end + def build_response dup.tap do |x| x.body = x.quoted_response diff --git a/app/views/forum_posts/_forum_post.html.erb b/app/views/forum_posts/_forum_post.html.erb index c1ebb5cfa..e80e54033 100644 --- a/app/views/forum_posts/_forum_post.html.erb +++ b/app/views/forum_posts/_forum_post.html.erb @@ -27,7 +27,11 @@ <% end %> <% end %> <% if forum_post.editable_by?(CurrentUser.user) %> -