Add browser notification for newly arrived mails

This commit is contained in:
hadi 2023-08-02 17:39:40 +02:00
parent d13151aa44
commit 713a9b3a93

View File

@ -575,10 +575,12 @@ app.classes.mail = AppJS.extend(
{ {
let framework = egw_getFramework(); let framework = egw_getFramework();
let notify = this.egw.preference('new_mail_notification', 'mail'); let notify = this.egw.preference('new_mail_notification', 'mail');
const message = egw.lang('New mail from %1', pushData.acl.from)+'\n'+pushData.acl.subject+'\n'+pushData.acl.snippet;
if (typeof notify === 'undefined' || notify === 'always' || if (typeof notify === 'undefined' || notify === 'always' ||
notify === 'not-mail' && framework && framework.activeApp.appName !== 'mail') notify === 'not-mail' && framework && framework.activeApp.appName !== 'mail')
{ {
this.egw.message(egw.lang('New mail from %1', pushData.acl.from)+'\n'+pushData.acl.subject+'\n'+pushData.acl.snippet, 'success'); this.egw.message(message, 'success');
this.egw.notification(egw.lang('new mail'), {body: message, tag: 'mail', icon: egw.image('navbar', 'mail')});
} }
}, },