bb
This commit is contained in:
parent
2e6afa5c76
commit
4b460cc83a
2 changed files with 27 additions and 27 deletions
|
@ -467,32 +467,34 @@ def api_comment(v):
|
||||||
|
|
||||||
if parent.author.id != v.id:
|
if parent.author.id != v.id:
|
||||||
if len(c.body) > 500: notifbody = c.body[:500] + '...'
|
if len(c.body) > 500: notifbody = c.body[:500] + '...'
|
||||||
elif c.body: notifbody = c.body
|
else: notifbody = c.body
|
||||||
else: notifbody = ''
|
|
||||||
|
|
||||||
beams_client.publish_to_interests(
|
try:
|
||||||
interests=[f'{request.host}{parent.author.id}'],
|
beams_client.publish_to_interests(
|
||||||
publish_body={
|
interests=[f'{request.host}{parent.author.id}'],
|
||||||
'web': {
|
publish_body={
|
||||||
'notification': {
|
'web': {
|
||||||
'title': f'New reply by @{v.username}',
|
'notification': {
|
||||||
'body': notifbody,
|
'title': f'New reply by @{v.username}',
|
||||||
'deep_link': f'https://{site}/comment/{c.id}?context=9&read=true#context',
|
'body': notifbody,
|
||||||
'icon': f'https://{request.host}/assets/images/{SITE_NAME}/icon.webp',
|
'deep_link': f'https://{site}/comment/{c.id}?context=9&read=true#context',
|
||||||
}
|
'icon': f'https://{request.host}/assets/images/{SITE_NAME}/icon.webp',
|
||||||
},
|
}
|
||||||
'fcm': {
|
|
||||||
'notification': {
|
|
||||||
'title': f'New reply by @{v.username}',
|
|
||||||
'body': notifbody,
|
|
||||||
},
|
},
|
||||||
'data': {
|
'fcm': {
|
||||||
'url': f'comment/{c.id}?context=9&read=true#context',
|
'notification': {
|
||||||
|
'title': f'New reply by @{v.username}',
|
||||||
|
'body': notifbody,
|
||||||
|
},
|
||||||
|
'data': {
|
||||||
|
'url': f'comment/{c.id}?context=9&read=true#context',
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
},
|
)
|
||||||
)
|
except Exception as e:
|
||||||
|
print(e)
|
||||||
|
print(c.id)
|
||||||
|
|
||||||
|
|
||||||
vote = CommentVote(user_id=v.id,
|
vote = CommentVote(user_id=v.id,
|
||||||
|
|
|
@ -437,8 +437,7 @@ def message2(v, username):
|
||||||
g.db.add(notif)
|
g.db.add(notif)
|
||||||
|
|
||||||
if len(message) > 500: notifbody = message[:500] + '...'
|
if len(message) > 500: notifbody = message[:500] + '...'
|
||||||
elif message: notifbody = message
|
else: notifbody = message
|
||||||
else: notifbody = ''
|
|
||||||
|
|
||||||
beams_client.publish_to_interests(
|
beams_client.publish_to_interests(
|
||||||
interests=[f'{request.host}{user.id}'],
|
interests=[f'{request.host}{user.id}'],
|
||||||
|
@ -505,8 +504,7 @@ def messagereply(v):
|
||||||
g.db.add(notif)
|
g.db.add(notif)
|
||||||
|
|
||||||
if len(message) > 500: notifbody = message[:500] + '...'
|
if len(message) > 500: notifbody = message[:500] + '...'
|
||||||
elif message: notifbody = message
|
else: notifbody = message
|
||||||
else: notifbody = ''
|
|
||||||
|
|
||||||
beams_client.publish_to_interests(
|
beams_client.publish_to_interests(
|
||||||
interests=[f'{request.host}{user_id}'],
|
interests=[f'{request.host}{user_id}'],
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue