forked from rDrama/rDrama
bbbb
parent
9c638fe3bb
commit
9c6d064b4a
|
@ -466,13 +466,16 @@ def api_comment(v):
|
||||||
g.db.add(n)
|
g.db.add(n)
|
||||||
|
|
||||||
if parent.author.id != v.id:
|
if parent.author.id != v.id:
|
||||||
|
if len(message) > 100: notifbody = c.body[:100] + '...'
|
||||||
|
else: notifbody = c.body
|
||||||
|
|
||||||
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 @{v.username}',
|
'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',
|
'deep_link': f'https://{site}/comment/{c.id}?context=9&read=true#context',
|
||||||
'icon': f'https://{request.host}/assets/images/{SITE_NAME}/icon.webp',
|
'icon': f'https://{request.host}/assets/images/{SITE_NAME}/icon.webp',
|
||||||
}
|
}
|
||||||
|
@ -480,7 +483,7 @@ def api_comment(v):
|
||||||
'fcm': {
|
'fcm': {
|
||||||
'notification': {
|
'notification': {
|
||||||
'title': f'New reply by @{v.username}',
|
'title': f'New reply by @{v.username}',
|
||||||
'body': c.body,
|
'body': notifbody,
|
||||||
'click_action': 'android.intent.category.DEFAULT',
|
'click_action': 'android.intent.category.DEFAULT',
|
||||||
},
|
},
|
||||||
'data': {
|
'data': {
|
||||||
|
|
|
@ -434,6 +434,8 @@ def message2(v, username):
|
||||||
notif = Notification(comment_id=new_comment.id, user_id=user.id)
|
notif = Notification(comment_id=new_comment.id, user_id=user.id)
|
||||||
g.db.add(notif)
|
g.db.add(notif)
|
||||||
|
|
||||||
|
if len(message) > 100: notifbody = message[:100] + '...'
|
||||||
|
else: notifbody = message
|
||||||
|
|
||||||
beams_client.publish_to_interests(
|
beams_client.publish_to_interests(
|
||||||
interests=[str(user.id)],
|
interests=[str(user.id)],
|
||||||
|
@ -441,7 +443,7 @@ def message2(v, username):
|
||||||
'web': {
|
'web': {
|
||||||
'notification': {
|
'notification': {
|
||||||
'title': f'New message from @{v.username}',
|
'title': f'New message from @{v.username}',
|
||||||
'body': message,
|
'body': notifbody,
|
||||||
'deep_link': f'https://{site}/notifications',
|
'deep_link': f'https://{site}/notifications',
|
||||||
'icon': f'https://{request.host}/assets/images/{SITE_NAME}/icon.webp',
|
'icon': f'https://{request.host}/assets/images/{SITE_NAME}/icon.webp',
|
||||||
}
|
}
|
||||||
|
@ -449,7 +451,7 @@ def message2(v, username):
|
||||||
'fcm': {
|
'fcm': {
|
||||||
'notification': {
|
'notification': {
|
||||||
'title': f'New message from @{v.username}',
|
'title': f'New message from @{v.username}',
|
||||||
'body': message,
|
'body': notifbody,
|
||||||
'click_action': 'android.intent.category.DEFAULT',
|
'click_action': 'android.intent.category.DEFAULT',
|
||||||
},
|
},
|
||||||
'data': {
|
'data': {
|
||||||
|
|
Loading…
Reference in New Issue