flags: fix deleting unapproved posts.

Don't trigger the "can't be flagged more than once in 3 days" rule when
generating the "Unapproved in three days" flag.
This commit is contained in:
evazion
2020-08-12 11:00:17 -05:00
parent f97137beb2
commit 4f57d0924f

View File

@@ -105,7 +105,7 @@ class PostFlag < ApplicationRecord
errors[:post] << "is locked and cannot be flagged" if post.is_status_locked?
flag = post.flags.in_cooldown.last
if flag.present?
if !is_deletion && flag.present?
errors[:post] << "cannot be flagged more than once every #{COOLDOWN_PERIOD.inspect} (last flagged: #{flag.created_at.to_s(:long)})"
end
end