DEV: Enable unless cops

We discussed the use of `unless` internally and decided to enforce
available rules from rubocop to restrict its most problematic uses.
This commit is contained in:
Loïc Guitaut
2023-02-16 10:40:11 +01:00
committed by Loïc Guitaut
parent 87de3c2319
commit f7c57fbc19
56 changed files with 137 additions and 142 deletions

View File

@@ -541,7 +541,7 @@ class PostsController < ApplicationController
] if post_revision.modifications["category_id"].present? &&
post_revision.modifications["category_id"][0] != topic.category.id
end
return render_json_error(I18n.t("revert_version_same")) unless changes.length > 0
return render_json_error(I18n.t("revert_version_same")) if changes.length <= 0
changes[:edit_reason] = I18n.with_locale(SiteSetting.default_locale) do
I18n.t("reverted_to_version", version: post_revision.number.to_i - 1)
end