From 2b690779608c1c53b8698465f062a145656896cb Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Mon, 21 Feb 2022 04:35:02 +0200 Subject: [PATCH] vc --- files/routes/comments.py | 42 +++++++++++++++++++--------------------- files/routes/users.py | 42 +++++++++++++++++++--------------------- 2 files changed, 40 insertions(+), 44 deletions(-) diff --git a/files/routes/comments.py b/files/routes/comments.py index 512680cfd..dab6694eb 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -586,30 +586,28 @@ def api_comment(v): if len(c.body) > 500: notifbody = c.body[:500] + '...' else: notifbody = c.body - try: - beams_client.publish_to_interests( - interests=[f'{request.host}{parent.author.id}'], - publish_body={ - 'web': { - 'notification': { - 'title': f'New reply by @{c.author_name}', - 'body': notifbody, - 'deep_link': f'{SITE_FULL}/comment/{c.id}?context=8&read=true#context', - 'icon': f'{SITE_FULL}/assets/images/{SITE_NAME}/icon.webp?a=1011', - } - }, - 'fcm': { - 'notification': { - 'title': f'New reply by @{c.author_name}', - 'body': notifbody, - }, - 'data': { - 'url': f'/comment/{c.id}?context=8&read=true#context', - } + beams_client.publish_to_interests( + interests=[f'{request.host}{parent.author.id}'], + publish_body={ + 'web': { + 'notification': { + 'title': f'New reply by @{c.author_name}', + 'body': notifbody, + 'deep_link': f'{SITE_FULL}/comment/{c.id}?context=8&read=true#context', + 'icon': f'{SITE_FULL}/assets/images/{SITE_NAME}/icon.webp?a=1011', } }, - ) - except: pass + 'fcm': { + 'notification': { + 'title': f'New reply by @{c.author_name}', + 'body': notifbody, + }, + 'data': { + 'url': f'/comment/{c.id}?context=8&read=true#context', + } + } + }, + ) vote = CommentVote(user_id=v.id, diff --git a/files/routes/users.py b/files/routes/users.py index 903a358af..7b016f41e 100644 --- a/files/routes/users.py +++ b/files/routes/users.py @@ -562,30 +562,28 @@ def messagereply(v): if len(message) > 500: notifbody = message[:500] + '...' else: notifbody = message - try: - 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'{SITE_FULL}/notifications?messages=true', - 'icon': f'{SITE_FULL}/assets/images/{SITE_NAME}/icon.webp"a=1010', - } - }, - 'fcm': { - 'notification': { - 'title': f'New message from @{v.username}', - 'body': notifbody, - }, - 'data': { - 'url': '/notifications?messages=true', - } + 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'{SITE_FULL}/notifications?messages=true', + 'icon': f'{SITE_FULL}/assets/images/{SITE_NAME}/icon.webp"a=1010', } }, - ) - except: pass + 'fcm': { + 'notification': { + 'title': f'New message from @{v.username}', + 'body': notifbody, + }, + 'data': { + 'url': '/notifications?messages=true', + } + } + }, + ) if new_comment.top_comment.sentto == 2: