FIX: moving a post to a topic with a deleted post should use correct post_number. Was getting unique index violation on (topic_id, post_number).

This commit is contained in:
Neil Lalonde
2014-08-20 12:28:34 -04:00
parent 6ef85ea014
commit 96eecf18ef
2 changed files with 31 additions and 1 deletions

View File

@ -575,7 +575,7 @@ class Topic < ActiveRecord::Base
end
def max_post_number
posts.maximum(:post_number).to_i
posts.with_deleted.maximum(:post_number).to_i
end
def move_posts(moved_by, post_ids, opts)