From 7b0feda4713d5bf4026e525e1276d6edc0058837 Mon Sep 17 00:00:00 2001 From: Aevann Date: Mon, 6 Mar 2023 00:50:36 +0200 Subject: [PATCH] fix modmail replies --- files/classes/user.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/files/classes/user.py b/files/classes/user.py index 25fdfcfb4..bd2eb7dca 100644 --- a/files/classes/user.py +++ b/files/classes/user.py @@ -1011,9 +1011,13 @@ class User(Base): return cls.can_see(user, other.post) else: if not user and not other.wall_user_id: return False - if not other.sentto: return True # handled by Notification - if other.sentto == MODMAIL_ID: return user.admin_level >= PERMS['VIEW_MODMAIL'] # type: ignore - if other.sentto != user.id: return user.admin_level >= PERMS['POST_COMMENT_MODERATION'] # type: ignore + + if other.sentto: + if other.sentto == MODMAIL_ID: + if other.top_comment.author_id == user.id: return True + return user.admin_level >= PERMS['VIEW_MODMAIL'] + if other.sentto != user.id: + return False elif isinstance(other, Sub): if other.name == 'chudrama': return bool(user) and user.can_see_chudrama if other.name in {'countryclub','splash_mountain'}: return bool(user) and user.can_see_countryclub