This commit is contained in:
Aevann1 2022-01-28 08:34:09 +02:00
parent 2d44092a85
commit 2a81b8e071
3 changed files with 28 additions and 25 deletions

View file

@ -534,35 +534,36 @@ def messagereply(v):
g.db.add(new_comment)
g.db.flush()
if PUSHER_ID and user_id != v.id:
if user_id != v.id:
notif = Notification(comment_id=new_comment.id, user_id=user_id)
g.db.add(notif)
if len(message) > 500: notifbody = message[:500] + '...'
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'{SITE_FULL}/notifications?messages=true',
'icon': f'{SITE_FULL}/assets/images/{SITE_NAME}/icon.webp',
if PUSHER_ID:
if len(message) > 500: notifbody = message[:500] + '...'
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'{SITE_FULL}/notifications?messages=true',
'icon': f'{SITE_FULL}/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: