modreports: fix reporting inaccessible dmails and forum posts.

* Fix it being possible to report dmails belonging to other users.
* Fix it being possible to report forum posts in mod-only threads.
This commit is contained in:
evazion
2020-02-03 22:09:35 -06:00
parent a5ebbc04e8
commit f87ec2509a
2 changed files with 2 additions and 2 deletions

View File

@@ -189,7 +189,7 @@ class Dmail < ApplicationRecord
end
def reportable_by?(user)
is_recipient? && !is_automated? && !from.is_moderator?
owner == user && is_recipient? && !is_automated? && !from.is_moderator?
end
def dtext_shortlink(key: false, **options)

View File

@@ -95,7 +95,7 @@ class ForumPost < ApplicationRecord
end
def reportable_by?(user)
creator_id != user.id && !creator.is_moderator?
visible?(user) && creator_id != user.id && !creator.is_moderator?
end
def votable?