fix modmail replies

pull/138/head
Aevann 2023-03-06 00:50:36 +02:00
parent 0c91650a1d
commit 7b0feda471
1 changed files with 7 additions and 3 deletions

View File

@ -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