master
Aevann1 2022-02-21 04:35:02 +02:00
parent 915d36d319
commit 2b69077960
2 changed files with 40 additions and 44 deletions

View File

@ -586,30 +586,28 @@ def api_comment(v):
if len(c.body) > 500: notifbody = c.body[:500] + '...' if len(c.body) > 500: notifbody = c.body[:500] + '...'
else: notifbody = c.body else: notifbody = c.body
try: beams_client.publish_to_interests(
beams_client.publish_to_interests( interests=[f'{request.host}{parent.author.id}'],
interests=[f'{request.host}{parent.author.id}'], publish_body={
publish_body={ 'web': {
'web': { 'notification': {
'notification': { 'title': f'New reply by @{c.author_name}',
'title': f'New reply by @{c.author_name}', 'body': notifbody,
'body': notifbody, 'deep_link': f'{SITE_FULL}/comment/{c.id}?context=8&read=true#context',
'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',
'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',
}
} }
}, },
) 'fcm': {
except: pass '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, vote = CommentVote(user_id=v.id,

View File

@ -562,30 +562,28 @@ def messagereply(v):
if len(message) > 500: notifbody = message[:500] + '...' if len(message) > 500: notifbody = message[:500] + '...'
else: notifbody = message else: notifbody = message
try: beams_client.publish_to_interests(
beams_client.publish_to_interests( interests=[f'{request.host}{user_id}'],
interests=[f'{request.host}{user_id}'], publish_body={
publish_body={ 'web': {
'web': { 'notification': {
'notification': { 'title': f'New message from @{v.username}',
'title': f'New message from @{v.username}', 'body': notifbody,
'body': notifbody, 'deep_link': f'{SITE_FULL}/notifications?messages=true',
'deep_link': f'{SITE_FULL}/notifications?messages=true', 'icon': f'{SITE_FULL}/assets/images/{SITE_NAME}/icon.webp"a=1010',
'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',
}
} }
}, },
) 'fcm': {
except: pass 'notification': {
'title': f'New message from @{v.username}',
'body': notifbody,
},
'data': {
'url': '/notifications?messages=true',
}
}
},
)
if new_comment.top_comment.sentto == 2: if new_comment.top_comment.sentto == 2: