modreports: don't allow reporting content more than 1 year old.

Don't allow users to report comments, forum posts, or dmails that are
more than 1 year old.
This commit is contained in:
evazion
2022-01-20 21:49:59 -06:00
parent 5fd0d498a4
commit 8d9cee5ad0
3 changed files with 3 additions and 3 deletions

View File

@@ -10,7 +10,7 @@ class CommentPolicy < ApplicationPolicy
end
def reportable?
unbanned? && record.creator_id != user.id && !record.creator.is_moderator? && !record.is_deleted?
unbanned? && record.creator_id != user.id && !record.creator.is_moderator? && !record.is_deleted? && record.created_at.after?(1.year.ago)
end
def can_sticky_comment?

View File

@@ -23,7 +23,7 @@ class DmailPolicy < ApplicationPolicy
end
def reportable?
unbanned? && record.owner_id == user.id && record.is_recipient? && !record.is_automated? && !record.from.is_moderator?
unbanned? && record.owner_id == user.id && record.is_recipient? && !record.is_automated? && !record.from.is_moderator? && record.created_at.after?(1.year.ago)
end
def permitted_attributes_for_create

View File

@@ -34,7 +34,7 @@ class ForumPostPolicy < ApplicationPolicy
end
def reportable?
unbanned? && show? && record.creator_id != user.id && !record.creator.is_moderator?
unbanned? && show? && record.creator_id != user.id && !record.creator.is_moderator? && record.created_at.after?(1.year.ago)
end
def show_deleted?