DEV: Improve code readability (#8967)

Follow-up to b0f72ca1 and 8e27fa1b.
This commit is contained in:
Dan Ungureanu 2020-02-14 13:05:52 +02:00 committed by GitHub
parent 7d94de6439
commit 8eae7d2799
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -361,11 +361,12 @@ class PostRevisor
end
POST_TRACKED_FIELDS.each do |field|
if @fields.has_key?(field) || (field == "edit_reason" && should_create_new_version?)
if @fields.has_key?(field)
@post.public_send("#{field}=", @fields[field])
end
end
@post.edit_reason = @fields[:edit_reason] if should_create_new_version?
@post.last_editor_id = @editor.id
@post.word_count = @fields[:raw].scan(/[[:word:]]+/).size if @fields.has_key?(:raw)
@post.self_edits += 1 if self_edit?