PERF: Optimize post editing

Reordering the conditions reduced the execution time by a factor of 5.
This commit is contained in:
Dan Ungureanu 2020-02-12 15:48:24 +02:00
parent 67c9940d72
commit 8e27fa1bd8
No known key found for this signature in database
GPG Key ID: 0AA2A00D6ACC8B84
1 changed files with 1 additions and 1 deletions

View File

@ -359,7 +359,7 @@ class PostRevisor
end
POST_TRACKED_FIELDS.each do |field|
if @fields.has_key?(field) || (should_create_new_version? && field == "edit_reason")
if @fields.has_key?(field) || (field == "edit_reason" && should_create_new_version?)
@post.public_send("#{field}=", @fields[field])
end
end