mirror of
https://github.com/discourse/discourse.git
synced 2025-06-06 13:06:56 +08:00
FIX: Broken spec
This commit is contained in:
@ -78,7 +78,6 @@ class PostsController < ApplicationController
|
|||||||
def create_post(params)
|
def create_post(params)
|
||||||
post_creator = PostCreator.new(current_user, params)
|
post_creator = PostCreator.new(current_user, params)
|
||||||
post = post_creator.create
|
post = post_creator.create
|
||||||
DiscourseEvent.trigger(:topic_saved, post.topic, params)
|
|
||||||
|
|
||||||
if post_creator.errors.present?
|
if post_creator.errors.present?
|
||||||
# If the post was spam, flag all the user's posts as spam
|
# If the post was spam, flag all the user's posts as spam
|
||||||
@ -86,6 +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)
|
||||||
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)]
|
||||||
|
Reference in New Issue
Block a user