mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 16:34:31 +08:00
Extensibility for tracking changes to a topic
This commit is contained in:
@ -85,7 +85,7 @@ class PostsController < ApplicationController
|
||||
[false, MultiJson.dump(errors: post_creator.errors.full_messages)]
|
||||
|
||||
else
|
||||
DiscourseEvent.trigger(:topic_saved, post.topic, params, current_user)
|
||||
DiscourseEvent.trigger(:topic_created, 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)]
|
||||
@ -382,7 +382,6 @@ class PostsController < ApplicationController
|
||||
permitted = [
|
||||
:raw,
|
||||
:topic_id,
|
||||
:title,
|
||||
:archetype,
|
||||
:category,
|
||||
:target_usernames,
|
||||
@ -415,8 +414,10 @@ class PostsController < ApplicationController
|
||||
result[:is_warning] = (params[:is_warning] == "true")
|
||||
end
|
||||
|
||||
# Enable plugins to whitelist additional parameters they might need
|
||||
DiscourseEvent.trigger(:permit_post_params, result, params)
|
||||
PostRevisor.tracked_fields.keys.each do |f|
|
||||
params.permit(f => [])
|
||||
result[f] = params[f] if params.has_key?(f)
|
||||
end
|
||||
|
||||
result
|
||||
end
|
||||
|
Reference in New Issue
Block a user