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:
@@ -189,7 +189,7 @@ class Dmail < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
def reportable_by?(user)
|
def reportable_by?(user)
|
||||||
is_recipient? && !is_automated? && !from.is_moderator?
|
owner == user && is_recipient? && !is_automated? && !from.is_moderator?
|
||||||
end
|
end
|
||||||
|
|
||||||
def dtext_shortlink(key: false, **options)
|
def dtext_shortlink(key: false, **options)
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ class ForumPost < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
def reportable_by?(user)
|
def reportable_by?(user)
|
||||||
creator_id != user.id && !creator.is_moderator?
|
visible?(user) && creator_id != user.id && !creator.is_moderator?
|
||||||
end
|
end
|
||||||
|
|
||||||
def votable?
|
def votable?
|
||||||
|
|||||||
Reference in New Issue
Block a user