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:
@@ -105,7 +105,7 @@ class PostFlag < ApplicationRecord
|
|||||||
errors[:post] << "is locked and cannot be flagged" if post.is_status_locked?
|
errors[:post] << "is locked and cannot be flagged" if post.is_status_locked?
|
||||||
|
|
||||||
flag = post.flags.in_cooldown.last
|
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)})"
|
errors[:post] << "cannot be flagged more than once every #{COOLDOWN_PERIOD.inspect} (last flagged: #{flag.created_at.to_s(:long)})"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user