FIX: when moving posts, retain creator and date from OP

This commit is contained in:
Sam Saffron
2015-11-07 15:17:47 +11:00
parent ca50252f77
commit ffa523a543
3 changed files with 20 additions and 4 deletions
+6 -2
View File
@@ -22,11 +22,15 @@ class PostMover
def to_new_topic(title, category_id=nil)
@move_type = PostMover.move_types[:new_topic]
post = Post.find_by(id: post_ids.first)
raise Discourse::InvalidParameters unless post
Topic.transaction do
move_posts_to Topic.create!(
user: user,
user: post.user,
title: title,
category_id: category_id
category_id: category_id,
created_at: post.created_at
)
end
end