Pass the `current_user` to the topic saved event

This commit is contained in:
Robin Ward 2015-01-08 17:29:11 -05:00
parent 74051a2df4
commit 0bc0bd7a21
2 changed files with 2 additions and 2 deletions

View File

@ -85,7 +85,7 @@ class PostsController < ApplicationController
[false, MultiJson.dump(errors: post_creator.errors.full_messages)]
else
DiscourseEvent.trigger(:topic_saved, post.topic, params)
DiscourseEvent.trigger(:topic_saved, post.topic, params, current_user)
post_serializer = PostSerializer.new(post, scope: guardian, root: false)
post_serializer.draft_sequence = DraftSequence.current(current_user, post.topic.draft_key)
[true, MultiJson.dump(post_serializer)]

View File

@ -135,7 +135,7 @@ class TopicsController < ApplicationController
success = PostRevisor.new(first_post, topic).revise!(current_user, changes, validate_post: false)
end
DiscourseEvent.trigger(:topic_saved, topic, params)
DiscourseEvent.trigger(:topic_saved, topic, params, current_user)
# this is used to return the title to the client as it may have been changed by "TextCleaner"
success ? render_serialized(topic, BasicTopicSerializer) : render_json_error(topic)