From e4e2dc868c82eea6bbb76010a390fc37bb21ee6a Mon Sep 17 00:00:00 2001 From: Aevann Date: Mon, 3 Jun 2024 15:13:01 +0300 Subject: [PATCH] exclude me and homocracy from push notifs except for janny chat --- files/helpers/alerts.py | 6 +++++- files/routes/chat.py | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/files/helpers/alerts.py b/files/helpers/alerts.py index 28f603e7e..a4b4d19cd 100644 --- a/files/helpers/alerts.py +++ b/files/helpers/alerts.py @@ -270,7 +270,7 @@ def NOTIFY_USERS(text, v, oldtext=None, ghost=False, obj=None, followers_ping=Tr return notify_users - BOT_IDs - {v.id, 0} - v.all_twoway_blocks - v.muters -def push_notif(uids, title, body, url_or_comment): +def push_notif(uids, title, body, url_or_comment, chat_id=None): if VAPID_PUBLIC_KEY == DEFAULT_CONFIG_VALUE: return @@ -279,6 +279,10 @@ def push_notif(uids, title, body, url_or_comment): if not uids: return + if SITE == 'rdrama.net' and chat_id != 182: + uids.discard(AEVANN_ID) + uids.discard(147) + if isinstance(url_or_comment, Comment): c = url_or_comment if c.is_banned: return diff --git a/files/routes/chat.py b/files/routes/chat.py index 31513170e..5433b0ca4 100644 --- a/files/routes/chat.py +++ b/files/routes/chat.py @@ -162,7 +162,7 @@ def speak(data, v): title = f'New messages in "{chat.name}"' body = '' url = f'{SITE_FULL}/chat/{chat.id}' - push_notif(uids, title, body, url) + push_notif(uids, title, body, url, chat_id=chat.id) notify_users = NOTIFY_USERS(chat_message.text, v) @@ -183,7 +183,7 @@ def speak(data, v): title = f'New mention of you in "{chat.name}"' body = chat_message.text url = f'{SITE_FULL}/chat/{chat.id}#{chat_message.id}' - push_notif(uids, title, body, url) + push_notif(uids, title, body, url, chat_id=chat.id) data = {