fixes #442
This commit is contained in:
@@ -42,7 +42,7 @@ class ForumPostsController < ApplicationController
|
||||
@forum_post = ForumPost.find(params[:id])
|
||||
check_privilege(@forum_post)
|
||||
@forum_post.update_attributes(params[:forum_post])
|
||||
respond_with(@forum_post, :location => forum_post_path(@forum_post))
|
||||
respond_with(@forum_post, :location => forum_topic_path(@forum_post.topic, :page => @forum_post.forum_topic_page))
|
||||
end
|
||||
|
||||
def destroy
|
||||
|
||||
@@ -114,6 +114,10 @@ class ForumPost < ActiveRecord::Base
|
||||
"[quote]\n#{creator_name} said:\n\n#{stripped_body}\n[/quote]\n\n"
|
||||
end
|
||||
|
||||
def forum_topic_page
|
||||
((ForumPost.where("topic_id = ? and created_at < ?", topic_id, created_at).count + 1) / Danbooru.config.posts_per_page.to_f).ceil
|
||||
end
|
||||
|
||||
def build_response
|
||||
dup.tap do |x|
|
||||
x.body = x.quoted_response
|
||||
|
||||
@@ -56,7 +56,7 @@ class ForumTopic < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def last_page
|
||||
(posts.count / Danbooru.config.posts_per_page.to_f).ceil
|
||||
((posts.count + 1) / Danbooru.config.posts_per_page.to_f).ceil
|
||||
end
|
||||
|
||||
def presenter(forum_posts)
|
||||
|
||||
Reference in New Issue
Block a user