Pass the `current_user` to the topic saved event
This commit is contained in:
parent
74051a2df4
commit
0bc0bd7a21
|
@ -85,7 +85,7 @@ class PostsController < ApplicationController
|
||||||
[false, MultiJson.dump(errors: post_creator.errors.full_messages)]
|
[false, MultiJson.dump(errors: post_creator.errors.full_messages)]
|
||||||
|
|
||||||
else
|
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 = PostSerializer.new(post, scope: guardian, root: false)
|
||||||
post_serializer.draft_sequence = DraftSequence.current(current_user, post.topic.draft_key)
|
post_serializer.draft_sequence = DraftSequence.current(current_user, post.topic.draft_key)
|
||||||
[true, MultiJson.dump(post_serializer)]
|
[true, MultiJson.dump(post_serializer)]
|
||||||
|
|
|
@ -135,7 +135,7 @@ class TopicsController < ApplicationController
|
||||||
success = PostRevisor.new(first_post, topic).revise!(current_user, changes, validate_post: false)
|
success = PostRevisor.new(first_post, topic).revise!(current_user, changes, validate_post: false)
|
||||||
end
|
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"
|
# 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)
|
success ? render_serialized(topic, BasicTopicSerializer) : render_json_error(topic)
|
||||||
|
|
Loading…
Reference in New Issue