A trigger when a topic is updated, adds a couple of custom field tests

This commit is contained in:
Robin Ward
2015-01-02 15:56:44 -05:00
parent 4c166942ad
commit 6f72f265cb
3 changed files with 10 additions and 5 deletions

View File

@ -2,6 +2,7 @@ require_dependency 'topic_view'
require_dependency 'promotion'
require_dependency 'url_helper'
require_dependency 'topics_bulk_action'
require_dependency 'discourse_event'
class TopicsController < ApplicationController
include UrlHelper
@ -134,6 +135,8 @@ class TopicsController < ApplicationController
success = PostRevisor.new(first_post, topic).revise!(current_user, changes, validate_post: false)
end
DiscourseEvent.trigger(:topic_saved, topic, params)
# 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)
end