diff options
| author | Alexandre Kühn <aku@odoo.com> | 2018-08-30 16:10:20 +0200 |
|---|---|---|
| committer | Alexandre Kühn <aku@odoo.com> | 2018-08-30 17:55:18 +0200 |
| commit | f80bbb4b2a1230ba543e97d3da01c7b2c52d24cc (patch) | |
| tree | 34d27fbdab943be7a2ebd675095060bb6ea512b5 /addons/mail/static/src/js/services/mail_manager.js | |
| parent | f8e3aed20ba073294fa1453f86709d6cbce650f5 (diff) | |
[IMP] mail, mail_bot: improved push notifications permission response
This commit makes small improvements on the messaging menu with
the new module `mail_bot`:
[IMP] When OdooBot has a request, it now adds "+1" to the counter of
the messaging menu. The related preview also has a bold title,
and displays "(1)" next to the title.
[REF] Static previews are no longer in mail_service. This was only
used for "OdooBot has a request" preview. This logic has now
been moved to the module `mail_bot` (was previously in `mail`).
[FIX] Title of response of push notifications permission clearly
states whether permission has been granted or denied
(was displaying "[Object object]" before this commit).
Task-ID 1877502
Diffstat (limited to 'addons/mail/static/src/js/services/mail_manager.js')
| -rw-r--r-- | addons/mail/static/src/js/services/mail_manager.js | 33 |
1 files changed, 2 insertions, 31 deletions
diff --git a/addons/mail/static/src/js/services/mail_manager.js b/addons/mail/static/src/js/services/mail_manager.js index a9cbf7d1072..734f12f0cf3 100644 --- a/addons/mail/static/src/js/services/mail_manager.js +++ b/addons/mail/static/src/js/services/mail_manager.js @@ -46,7 +46,6 @@ var PREVIEW_MSG_MAX_SIZE = 350; // optimal for native english speakers var MailManager = AbstractService.extend({ dependencies: ['ajax', 'bus_service', 'local_storage'], _ODOOBOT_ID: "ODOOBOT", // default authorID for transient messages - IS_STATIC_PREVIEW_ENABLED: true, /** * @override @@ -232,17 +231,13 @@ var MailManager = AbstractService.extend({ var inboxDef = this._getSystrayInboxPreviews(filter); var failureDef = this._getSystrayMailFailurePreviews(filter); defs = defs.concat([channelDef, inboxDef, failureDef]); - if (this.IS_STATIC_PREVIEW_ENABLED) { - var staticDef = this._getSystrayStaticPreviews(filter); - defs.push(staticDef); - } return $.when.apply($, defs) - .then(function (previewsChannel, previewsInbox, previewsFailure, previewsStatic) { + .then(function (previewsChannel, previewsInbox, previewsFailure) { // order: failures > inbox > channel, each group must be sorted previewsChannel = self._sortPreviews(previewsChannel); previewsInbox = self._sortPreviews(previewsInbox); previewsFailure = self._sortPreviews(previewsFailure); - return _.union(previewsStatic, previewsFailure, previewsInbox, previewsChannel); + return _.union(previewsFailure, previewsInbox, previewsChannel); }); }, /** @@ -817,30 +812,6 @@ var MailManager = AbstractService.extend({ } }, /** - * Get the previews of static systray elements, adding notification request - * - * @private - * @param {string|undefined} [filter] - * @returns {$.Promise<Object[]>} resolved with list of object that are - * compatible with preview template of mail systray menu - */ - _getSystrayStaticPreviews: function (filter) { - var elems = []; - if ( - window.Notification && window.Notification.permission === "default" && - (filter === 'mailbox_inbox' || !filter) - ) { - elems.push({ - title: _t("OdooBot has a request"), - imageSRC: "/mail/static/src/img/odoobot.png", - status: 'bot', - body: _t("Enable desktop notifications to chat"), - id: 'request_notification', - }); - } - return $.when(elems); - }, - /** * Initialize the internal state of the mail service. Ensure that all * attributes are set before doing any operation on them. * |
