diff options
| author | Aaron Bohy <aab@odoo.com> | 2020-04-29 07:21:40 +0000 |
|---|---|---|
| committer | Aaron Bohy <aab@odoo.com> | 2020-05-05 10:05:12 +0000 |
| commit | e63ffeab5aadc69bdb5bc4f25238f9138055d3ed (patch) | |
| tree | d128ab0fab4bdeeb3fce9a25e2b935e6f91f2d34 /addons/mail/static | |
| parent | df4693e7ffe8082335355b9a7c573d1038547f89 (diff) | |
[REF] mail,hr: move openDMChatWindow to MailManager
It will be used by the Many2OneAvatarUser widget defined in the
next commit.
Diffstat (limited to 'addons/mail/static')
| -rw-r--r-- | addons/mail/static/src/js/services/mail_window_manager.js | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/addons/mail/static/src/js/services/mail_window_manager.js b/addons/mail/static/src/js/services/mail_window_manager.js index c0e8a1e77d3..cb0eb0b7dca 100644 --- a/addons/mail/static/src/js/services/mail_window_manager.js +++ b/addons/mail/static/src/js/services/mail_window_manager.js @@ -53,6 +53,20 @@ MailManager.include({ } }, /** + * Open a DM chat in a thread window. + * + * @param {integer} partnerID + * @returns {Promise} + */ + openDMChatWindow: async function (partnerID) { + let dmChat = this.call('mail_service', 'getDMChatFromPartnerID', partnerID); + if (!dmChat) { + const dmChatId = await this.call('mail_service', 'createChannel', partnerID, 'dm_chat'); + dmChat = this.call('mail_service', 'getChannel', dmChatId); + } + dmChat.detach(); + }, + /** * Open a DM chat in a thread window. This is useful when selecting a DM * chatin the blank thread window, so that it replaces it with the DM chat * window. |
