From 379e85647c5f093fcda73fd715551032799ca202 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sun, 16 Jan 2022 08:24:33 +0200 Subject: [PATCH] bb --- files/routes/users.py | 52 +++++++++++++++++++++---------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/files/routes/users.py b/files/routes/users.py index 7c3d69a1df..5fdcf7ca70 100644 --- a/files/routes/users.py +++ b/files/routes/users.py @@ -497,35 +497,35 @@ def messagereply(v): g.db.add(new_comment) g.db.flush() - notif = Notification(comment_id=new_comment.id, user_id=user_id) - g.db.add(notif) + if user_id != v.id: + notif = Notification(comment_id=new_comment.id, user_id=user_id) + g.db.add(notif) - - if len(message) > 100: notifbody = message[:100] + '...' - else: notifbody = message - - beams_client.publish_to_interests( - interests=[f'{request.host}{user_id}'], - publish_body={ - 'web': { - 'notification': { - 'title': f'New message from @{v.username}', - 'body': notifbody, - 'deep_link': f'https://{site}/notifications?messages=true', - 'icon': f'https://{request.host}/assets/images/{SITE_NAME}/icon.webp', + if len(message) > 100: notifbody = message[:100] + '...' + else: notifbody = message + + beams_client.publish_to_interests( + interests=[f'{request.host}{user_id}'], + publish_body={ + 'web': { + 'notification': { + 'title': f'New message from @{v.username}', + 'body': notifbody, + 'deep_link': f'https://{site}/notifications?messages=true', + 'icon': f'https://{request.host}/assets/images/{SITE_NAME}/icon.webp', + } + }, + 'fcm': { + 'notification': { + 'title': f'New message from @{v.username}', + 'body': notifbody, + }, + 'data': { + 'url': 'notifications?messages=true', + } } }, - 'fcm': { - 'notification': { - 'title': f'New message from @{v.username}', - 'body': notifbody, - }, - 'data': { - 'url': 'notifications?messages=true', - } - } - }, - ) + ) if new_comment.top_comment.sentto == 0: