mirror of
https://github.com/discourse/discourse.git
synced 2025-05-31 02:58:48 +08:00
Merge pull request #2718 from riking/plugin-events
FEATURE: Add a plugin callback when editing a post
This commit is contained in:
@ -69,6 +69,7 @@ class PostCreator
|
||||
setup_topic
|
||||
setup_post
|
||||
rollback_if_host_spam_detected
|
||||
plugin_callbacks
|
||||
save_post
|
||||
extract_links
|
||||
store_unique_post_key
|
||||
@ -113,7 +114,6 @@ class PostCreator
|
||||
|
||||
post.cooked ||= post.cook(post.raw, cooking_options)
|
||||
post.sort_order = post.post_number
|
||||
DiscourseEvent.trigger(:before_create_post, post)
|
||||
post.last_version_at ||= Time.now
|
||||
end
|
||||
|
||||
@ -157,6 +157,11 @@ class PostCreator
|
||||
end
|
||||
end
|
||||
|
||||
def plugin_callbacks
|
||||
DiscourseEvent.trigger :before_create_post, @post
|
||||
DiscourseEvent.trigger :validate_post, @post
|
||||
end
|
||||
|
||||
def track_latest_on_category
|
||||
return unless @post && @post.errors.count == 0 && @topic && @topic.category_id
|
||||
|
||||
|
Reference in New Issue
Block a user