mirror of
https://github.com/discourse/discourse.git
synced 2025-02-22 00:03:26 +08:00
Add new 'post_moved' event
This commit is contained in:
parent
4f09a5a7a5
commit
c2061aae3d
@ -98,6 +98,9 @@ class PostMover
|
|||||||
new_post.update_column(:reply_count, @reply_count[1] || 0)
|
new_post.update_column(:reply_count, @reply_count[1] || 0)
|
||||||
new_post.custom_fields = post.custom_fields
|
new_post.custom_fields = post.custom_fields
|
||||||
new_post.save_custom_fields
|
new_post.save_custom_fields
|
||||||
|
|
||||||
|
DiscourseEvent.trigger(:post_moved, new_post, original_topic.id)
|
||||||
|
|
||||||
new_post
|
new_post
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -116,7 +119,9 @@ class PostMover
|
|||||||
update[:reply_to_user_id] = nil
|
update[:reply_to_user_id] = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
Post.where(id: post.id, topic_id: original_topic.id).update_all(update)
|
post.update(update)
|
||||||
|
|
||||||
|
DiscourseEvent.trigger(:post_moved, post, original_topic.id)
|
||||||
|
|
||||||
# Move any links from the post to the new topic
|
# Move any links from the post to the new topic
|
||||||
post.topic_links.update_all(topic_id: destination_topic.id)
|
post.topic_links.update_all(topic_id: destination_topic.id)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user