From fb520034047f2dd09246cc747cd6a47764fc2735 Mon Sep 17 00:00:00 2001 From: TLSM Date: Sun, 12 Jun 2022 22:11:55 -0400 Subject: [PATCH] Hide block & follow notifs from shadowed. --- files/routes/settings.py | 6 ++++-- files/routes/users.py | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/files/routes/settings.py b/files/routes/settings.py index 2b628703c7..1bcea826ac 100644 --- a/files/routes/settings.py +++ b/files/routes/settings.py @@ -672,7 +672,8 @@ def settings_block_user(v): if not user: return {"error": "That user doesn't exist."}, 404 if user.unblockable: - send_notification(user.id, f"@{v.username} has tried to block you and failed because of your unblockable status!") + if not v.shadowbanned: + send_notification(user.id, f"@{v.username} has tried to block you and failed because of your unblockable status!") g.db.commit() return {"error": "This user is unblockable."}, 403 @@ -713,7 +714,8 @@ def settings_unblock_user(v): g.db.delete(x) - send_notification(user.id, f"@{v.username} has unblocked you!") + if not v.shadowbanned: + send_notification(user.id, f"@{v.username} has unblocked you!") cache.delete_memoized(frontlist) diff --git a/files/routes/users.py b/files/routes/users.py index adc6e3e121..cb0552e7c5 100644 --- a/files/routes/users.py +++ b/files/routes/users.py @@ -1108,7 +1108,8 @@ def follow_user(username, v): target.stored_subscriber_count = g.db.query(Follow).filter_by(target_id=target.id).count() g.db.add(target) - send_notification(target.id, f"@{v.username} has followed you!") + if not v.shadowbanned: + send_notification(target.id, f"@{v.username} has followed you!") g.db.commit() @@ -1123,7 +1124,8 @@ def unfollow_user(username, v): target = get_user(username) if target.fish: - send_notification(target.id, f"@{v.username} has tried to unfollow you and failed because of your fish award!") + if not v.shadowbanned: + send_notification(target.id, f"@{v.username} has tried to unfollow you and failed because of your fish award!") g.db.commit() return {"error": "You can't unfollow this user!"}