FEATURE: Pass instance of revisor to post_edited DiscourseEvent.

This commit is contained in:
Guo Xiang Tan 2020-05-11 16:32:41 +08:00
parent 8233610d92
commit f293b28198
No known key found for this signature in database
GPG Key ID: FBD110179AAC1F20

View File

@ -43,7 +43,7 @@ class PostRevisor
POST_TRACKED_FIELDS = %w{raw cooked edit_reason user_id wiki post_type}
attr_reader :category_changed
attr_reader :category_changed, :post_revision
def initialize(post, topic = post.topic)
@post = post
@ -469,7 +469,7 @@ class PostRevisor
modifications["cooked"][0] = cached_original_cooked || modifications["cooked"][0]
end
PostRevision.create!(
@post_revision = PostRevision.create!(
user_id: @post.last_editor_id,
post_id: @post.id,
number: @post.version,
@ -598,7 +598,7 @@ class PostRevisor
def post_process_post
@post.invalidate_oneboxes = true
@post.trigger_post_process
DiscourseEvent.trigger(:post_edited, @post, self.topic_changed?)
DiscourseEvent.trigger(:post_edited, @post, self.topic_changed?, self)
end
def update_topic_word_counts