remotes/1693045480750635534/spooky-22
Aevann1 2022-01-16 03:44:07 +02:00
parent 9c638fe3bb
commit 9c6d064b4a
2 changed files with 9 additions and 4 deletions

View File

@ -466,13 +466,16 @@ def api_comment(v):
g.db.add(n)
if parent.author.id != v.id:
if len(message) > 100: notifbody = c.body[:100] + '...'
else: notifbody = c.body
beams_client.publish_to_interests(
interests=[f'{request.host}{parent.author.id}'],
publish_body={
'web': {
'notification': {
'title': f'New reply by @{v.username}',
'body': c.body,
'body': notifbody,
'deep_link': f'https://{site}/comment/{c.id}?context=9&read=true#context',
'icon': f'https://{request.host}/assets/images/{SITE_NAME}/icon.webp',
}
@ -480,7 +483,7 @@ def api_comment(v):
'fcm': {
'notification': {
'title': f'New reply by @{v.username}',
'body': c.body,
'body': notifbody,
'click_action': 'android.intent.category.DEFAULT',
},
'data': {

View File

@ -434,6 +434,8 @@ def message2(v, username):
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=[str(user.id)],
@ -441,7 +443,7 @@ def message2(v, username):
'web': {
'notification': {
'title': f'New message from @{v.username}',
'body': message,
'body': notifbody,
'deep_link': f'https://{site}/notifications',
'icon': f'https://{request.host}/assets/images/{SITE_NAME}/icon.webp',
}
@ -449,7 +451,7 @@ def message2(v, username):
'fcm': {
'notification': {
'title': f'New message from @{v.username}',
'body': message,
'body': notifbody,
'click_action': 'android.intent.category.DEFAULT',
},
'data': {