summaryrefslogtreecommitdiff
path: root/addons/mail/static/src
diff options
context:
space:
mode:
authorXavierDo <xdo@odoo.com>2018-05-07 11:36:30 +0200
committerThibault Delavallée <tde@odoo.com>2018-08-10 13:33:28 +0200
commitc446fb20015d489d9c38e97e10f25cf2e5e3efd7 (patch)
treea81bfc70ad56ce17ee8ee5c54fda4ec1324dc2b2 /addons/mail/static/src
parent340e1c0219a9c5101110a6d7e597dc1a2a549706 (diff)
[IMP] auth_signup, mail: notify inviter user when invited user connects
Purpose of this commit is to improve the onboarding and the first steps of Odoo notably when using Discuss and inviting first people to join Odoo. When a new user connects the user who invited him will be notified with a desktop notification inviting him to have a chat in Discuss and talk together. This commit is linked to task ID 1838588 and PR #25075.
Diffstat (limited to 'addons/mail/static/src')
-rw-r--r--addons/mail/static/src/js/services/mail_notification_manager.js29
1 files changed, 24 insertions, 5 deletions
diff --git a/addons/mail/static/src/js/services/mail_notification_manager.js b/addons/mail/static/src/js/services/mail_notification_manager.js
index b3e5239f9ee..475cbd44f90 100644
--- a/addons/mail/static/src/js/services/mail_notification_manager.js
+++ b/addons/mail/static/src/js/services/mail_notification_manager.js
@@ -165,13 +165,13 @@ MailManager.include({
* Add or remove failure when receiving a failure update message
*
* @private
- * @param {Object} data
- * @param {Object[]} data.elements list of mail failure data
- * @param {string} data.elements[].message_id ID of related message that
+ * @param {Object} datas
+ * @param {Object[]} datas.elements list of mail failure data
+ * @param {string} datas.elements[].message_id ID of related message that
* has a mail failure.
- * @param {Array} data.elements[].notifications list of notifications
+ * @param {Array} datas.elements[].notifications list of notifications
* that is related to a mail failure.
- * @param {string} data.elements[].notifications[0] sending state of a mail
+ * @param {string} datas.elements[].notifications[0] sending state of a mail
* failure (e.g. 'exception').
*/
_handlePartnerMailFailureNotification: function (datas) {
@@ -313,6 +313,8 @@ MailManager.include({
this._handlePartnerActivityUpdateNotification(data);
} else if (data.type === 'mail_failure') {
this._handlePartnerMailFailureNotification(data);
+ } else if (data.type === 'user_connection') {
+ this._handlePartnerUserConnectionNotification(data);
} else {
this._handlePartnerChannelNotification(data);
}
@@ -403,7 +405,24 @@ MailManager.include({
this.do_notify(_("Unsubscribed"), message);
}
},
+ /**
+ * Shows a popup to notify a user connection
+ *
+ * @private
+ * @param {Object} data
+ * @param {Object[]} data.partner_id id of the connected partner
+ * @param {string} data.title title to display on notification
+ * @param {Array} data.messages message to display on notification
+ */
+ _handlePartnerUserConnectionNotification: function (data) {
+ var self=this;
+ var partner_id = data.partner_id;
+ this.call('bus_service', 'sendNotification', data.title, data.message, function(){
+ self.call('mail_service', 'openDmWindow', partner_id);
+ });
+ },
/**
+ *
* On receiving an update on user status (e.g. becoming 'online', 'offline',
* 'idle', etc.).
*