summaryrefslogtreecommitdiff
path: root/addons/mail/static/src/js/models/threads/thread.js
diff options
context:
space:
mode:
authorVincent Schippefilt <vsc@odoo.com>2019-03-06 14:02:19 +0100
committerAaron Bohy <aab@odoo.com>2019-03-06 20:07:17 +0100
commit1ae64793fa489b2c1d07408cd9671bc7126f78fa (patch)
tree23d908222f4e705b908dd23ef3823c26daf3baf0 /addons/mail/static/src/js/models/threads/thread.js
parentaa900d976f6fbb10f3940639b4d918d31a7556ca (diff)
[REF] mail: adapt code after jQuery update
Part of task 1896658 Co-authored-by: Aaron Bohy <aab@odoo.com> Co-authored-by: Christophe Matthieu <chm@odoo.com> Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com> Co-authored-by: David Monjoie <dmo@odoo.com> Co-authored-by: Martin Geubelle <mge@odoo.com> Co-authored-by: svs-odoo <svs@odoo.com> Co-authored-by: Vincent Schippefilt <vsc@odoo.com>
Diffstat (limited to 'addons/mail/static/src/js/models/threads/thread.js')
-rw-r--r--addons/mail/static/src/js/models/threads/thread.js22
1 files changed, 12 insertions, 10 deletions
diff --git a/addons/mail/static/src/js/models/threads/thread.js b/addons/mail/static/src/js/models/threads/thread.js
index 8c622779bb3..8f4e8956d27 100644
--- a/addons/mail/static/src/js/models/threads/thread.js
+++ b/addons/mail/static/src/js/models/threads/thread.js
@@ -58,12 +58,13 @@ var Thread = AbstractThread.extend(ServicesMixin, {
* of this thread. Otherwise unfold it while detaching it.
* @param {boolean} [options.passively=false] if set, if the thread window
* will be created passively.
+ * @returns {Promise}
*/
detach: function (options) {
options = options || {};
this._detached = true;
this._folded = options.keepFoldState ? this._folded : false;
- this._warnUpdatedWindowState({
+ return this._warnUpdatedWindowState({
passively: options.passively,
});
},
@@ -79,10 +80,10 @@ var Thread = AbstractThread.extend(ServicesMixin, {
* `this.LIMIT` number of messages at a time.
*
* @abstract
- * @returns {$.Promise<mail.model.Message[]>}
+ * @returns {Promise<mail.model.Message[]>}
*/
fetchMessages: function () {
- return $.when([]);
+ return Promise.resolve([]);
},
/**
* Updates the folded state of the thread. Must be overriden to reflect
@@ -110,10 +111,10 @@ var Thread = AbstractThread.extend(ServicesMixin, {
* By default, a thread has not listener.
*
* @abstract
- * @returns {$.Promise<Array<Object[]>>}
+ * @returns {Promise<Array<Object[]>>}
*/
getMentionPartnerSuggestions: function () {
- return $.when([]);
+ return Promise.resolve([]);
},
/**
* Returns the information required to render the preview of this channel.
@@ -287,10 +288,10 @@ var Thread = AbstractThread.extend(ServicesMixin, {
/**
* @abstract
* @private
- * @return {$.Promise}
+ * @return {Promise}
*/
_fetchMessages: function () {
- return $.when();
+ return Promise.resolve();
},
/**
* Replace character representations of emojis by their unicode
@@ -330,7 +331,7 @@ var Thread = AbstractThread.extend(ServicesMixin, {
* @abstract
* @private
* @param {Object} data
- * @returns {$.Promise<Object>} resolved with the message object to be sent
+ * @returns {Promise<Object>} resolved with the message object to be sent
* to the server
*/
_postMessage: function (data) {
@@ -355,7 +356,7 @@ var Thread = AbstractThread.extend(ServicesMixin, {
messageData.subject = data.subject;
}
return this._super.apply(this, arguments).then(function () {
- return $.when(messageData);
+ return messageData;
});
},
/**
@@ -374,10 +375,11 @@ var Thread = AbstractThread.extend(ServicesMixin, {
* @private
* @param {Object} [options={}]
* @param {boolean} [options.passively=false]
+ * @returns {Promise}
*/
_warnUpdatedWindowState: function (options) {
options = options || {};
- this.call('mail_service', 'updateThreadWindow', this.getID(), options);
+ return this.call('mail_service', 'updateThreadWindow', this.getID(), options);
},
});