fix MESSAGE_BLOCKED_USERS and make it apply to mutes too

master
Aevann 2024-08-06 18:31:41 +03:00
parent 8ce3986474
commit a5de76b205
3 changed files with 6 additions and 6 deletions

View File

@ -372,11 +372,11 @@ def messagereply(v):
user = get_account(user_id, v=v, include_blocks=True)
if hasattr(user, 'is_blocking') and user.is_blocking:
abort(403, f"You're blocking @{user.username}")
elif (v.admin_level <= PERMS['MESSAGE_BLOCKED_USERS']
elif (v.admin_level < PERMS['MESSAGE_BLOCKED_USERS']
and hasattr(user, 'is_blocked') and user.is_blocked):
abort(403, f"You're blocked by @{user.username}")
if user.has_muted(v):
if v.admin_level < PERMS['MESSAGE_BLOCKED_USERS'] and user.has_muted(v):
abort(403, f"@{user.username} is muting notifications from you, so messaging them is pointless!")
if not g.is_tor and get_setting("dm_media"):

View File

@ -26,10 +26,10 @@ def chat_user(v, username):
if hasattr(user, 'is_blocking') and user.is_blocking:
abort(403, f"You're blocking @{user.username}")
if v.admin_level <= PERMS['MESSAGE_BLOCKED_USERS'] and hasattr(user, 'is_blocked') and user.is_blocked:
if v.admin_level < PERMS['MESSAGE_BLOCKED_USERS'] and hasattr(user, 'is_blocked') and user.is_blocked:
abort(403, f"@{user.username} is blocking you!")
if user.has_muted(v):
if v.admin_level < PERMS['MESSAGE_BLOCKED_USERS'] and user.has_muted(v):
abort(403, f"@{user.username} is muting notifications from you, so you can't chat with them!")

View File

@ -619,10 +619,10 @@ def message(v, username=None, id=None):
if hasattr(user, 'is_blocking') and user.is_blocking:
abort(403, f"You're blocking @{user.username}")
if v.admin_level <= PERMS['MESSAGE_BLOCKED_USERS'] and hasattr(user, 'is_blocked') and user.is_blocked:
if v.admin_level < PERMS['MESSAGE_BLOCKED_USERS'] and hasattr(user, 'is_blocked') and user.is_blocked:
abort(403, f"@{user.username} is blocking you!")
if user.has_muted(v):
if v.admin_level < PERMS['MESSAGE_BLOCKED_USERS'] and user.has_muted(v):
abort(403, f"@{user.username} is muting notifications from you, so messaging them is pointless!")
body = request.values.get("message", "").strip()