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:
@@ -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?
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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?
|
||||
|
||||
Reference in New Issue
Block a user