mirror of
https://github.com/discourse/discourse.git
synced 2025-05-21 18:12:32 +08:00
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:

committed by
Loïc Guitaut

parent
87de3c2319
commit
f7c57fbc19
@ -148,7 +148,7 @@ class PostCreator
|
||||
end
|
||||
end
|
||||
|
||||
unless @topic.present? && (@opts[:skip_guardian] || guardian.can_create?(Post, @topic))
|
||||
if @topic.blank? || !(@opts[:skip_guardian] || guardian.can_create?(Post, @topic))
|
||||
errors.add(:base, I18n.t(:topic_not_found))
|
||||
return false
|
||||
end
|
||||
|
Reference in New Issue
Block a user