Merge pull request #1039 from expsa/samir-aladawi-send-all-notifications
[FIX] odex_web_app: firebase api body
This commit is contained in:
commit
76ac4559d3
|
|
@ -45,9 +45,22 @@ class HrEmployee(models.Model):
|
|||
'Authorization': 'Bearer %s' % (_get_access_token(temp_file_path))
|
||||
}
|
||||
body = json.dumps({
|
||||
"to": self.fcm_token_web,
|
||||
"direct_boot_ok": True,
|
||||
"notification": notification
|
||||
"message": {
|
||||
"token": self.fcm_token_web,
|
||||
"notification": notification,
|
||||
"android": {
|
||||
"notification": {
|
||||
"sound": "default"
|
||||
}
|
||||
},
|
||||
"apns": {
|
||||
"payload": {
|
||||
"aps": {
|
||||
"sound": "default"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
FCM_ENDPOINT = 'v1/projects/' + service_account_json['project_id'] + '/messages:send'
|
||||
FCM_URL = BASE_URL + '/' + FCM_ENDPOINT
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ class MailActivity(models.Model):
|
|||
if employee_id:
|
||||
push_notify = employee_id.user_push_notification_web({
|
||||
"title": activity_id.summary or activity_id.create_uid.name,
|
||||
"body": notification_body,
|
||||
"sound": "default"
|
||||
"body": notification_body
|
||||
})
|
||||
return activity_ids
|
||||
|
|
@ -38,7 +38,6 @@ class Message(models.Model):
|
|||
for employee_id in self.env['hr.employee'].sudo().search([('user_id', 'in', partner_ids.user_ids.ids)]):
|
||||
push_notify = employee_id.user_push_notification_web({
|
||||
"title": message.author_id.name,
|
||||
"body": notification_body,
|
||||
"sound": "default"
|
||||
"body": notification_body
|
||||
})
|
||||
return messages
|
||||
|
|
@ -27,8 +27,7 @@ class MailThread(models.AbstractModel):
|
|||
for employee_id in self.env['hr.employee'].sudo().search([('user_id', 'in', partners_to_notify.user_ids.ids)]):
|
||||
push_notify = employee_id.user_push_notification_web({
|
||||
"title": self.display_name,
|
||||
"body": notification_body,
|
||||
"sound": "default"
|
||||
"body": notification_body
|
||||
})
|
||||
|
||||
return super(MailThread, self).message_post(message_type=message_type, **kwargs)
|
||||
Loading…
Reference in New Issue