mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 19:46:55 +08:00
DEV: Improve code readability (#8967)
Follow-up tob0f72ca1
and8e27fa1b
.
This commit is contained in:
parent
7d94de6439
commit
8eae7d2799
|
@ -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?
|
||||
|
|
Loading…
Reference in New Issue
Block a user