DEV: create new_post_moved event trigger when moving posts (#24005)

This change adds a new event trigger (new_post_moved) when the first post in a topic is moved to a new topic.

Plugins that listen for the new_post_moved event now have an easy way to update old data based on the post id.
This commit is contained in:
David Battersby
2023-10-20 17:56:50 +08:00
committed by GitHub
parent 467e1a1bdd
commit 75441e063a
2 changed files with 41 additions and 0 deletions

View File

@ -277,6 +277,7 @@ class PostMover
new_post.custom_fields = post.custom_fields
new_post.save_custom_fields
DiscourseEvent.trigger(:first_post_moved, new_post, post)
DiscourseEvent.trigger(:post_moved, new_post, original_topic.id)
# we don't want to keep the old topic's OP bookmarked when we are