fix the build (again)

This commit is contained in:
Régis Hanol 2014-11-17 16:06:43 +01:00
parent dd9c475ea0
commit 7bb9a839e5
2 changed files with 6 additions and 3 deletions

View File

@ -130,7 +130,7 @@ class TopicsController < ApplicationController
if changes.length > 0
first_post = topic.ordered_posts.first
success = PostRevisor.new(first_post, topic).revise!(current_user, changes, skip_validations: true)
success = PostRevisor.new(first_post, topic).revise!(current_user, changes, validate_post: false)
end
# this is used to return the title to the client as it may have been changed by "TextCleaner"

View File

@ -42,6 +42,9 @@ class PostRevisor
@post_successfully_saved = true
@topic_successfully_saved = true
@validate_post = @opts[:validate_post] || !@opts[:skip_validations]
@validate_topic = @opts[:validate_topic] || !@opts[:skip_validations]
Post.transaction do
revise_post
@ -145,7 +148,7 @@ class PostRevisor
clear_flags_and_unhide_post
@post.extract_quoted_post_numbers
@post_successfully_saved = @post.save(validate: !@opts[:skip_validations])
@post_successfully_saved = @post.save(validate: @validate_post)
@post.save_reply_relationships
end
@ -169,7 +172,7 @@ class PostRevisor
@topic.title = @fields[:title] if @fields.has_key?(:title)
Topic.transaction do
@topic_successfully_saved = @topic.change_category_to_id(@fields[:category_id]) if @fields.has_key?(:category_id)
@topic_successfully_saved &&= @topic.save(validate: !@opts[:skip_validations])
@topic_successfully_saved &&= @topic.save(validate: @validate_topic)
end
end