summaryrefslogtreecommitdiff
path: root/addons/mail/static/src/js/models/threads/abstract_thread.js
diff options
context:
space:
mode:
Diffstat (limited to 'addons/mail/static/src/js/models/threads/abstract_thread.js')
-rw-r--r--addons/mail/static/src/js/models/threads/abstract_thread.js29
1 files changed, 28 insertions, 1 deletions
diff --git a/addons/mail/static/src/js/models/threads/abstract_thread.js b/addons/mail/static/src/js/models/threads/abstract_thread.js
index 3ea263fa996..788a04307a7 100644
--- a/addons/mail/static/src/js/models/threads/abstract_thread.js
+++ b/addons/mail/static/src/js/models/threads/abstract_thread.js
@@ -6,15 +6,42 @@ var Class = require('web.Class');
/**
* Abstract thread is the super class of all threads, either backend threads
* (which are compatible with mail service) or website livechats.
+ *
+ * Abstract threads contain abstract messages
*/
var AbstractThread = Class.extend({
- init: function (parent, data) {},
+ /**
+ * @param {Object} params
+ * @param {Object} params.data
+ * @param {Object} params.data.id the ID of this thread
+ */
+ init: function (params) {
+ this._id = params.data.id;
+ },
//--------------------------------------------------------------------------
// Public
//--------------------------------------------------------------------------
+ /**
+ * Get the ID of this thread
+ *
+ * @returns {integer|string}
+ */
+ getID: function () {
+ return this._id;
+ },
+ /**
+ * @abstract
+ * @returns {mail.model.AbstractMessage[]}
+ */
getMessages: function () {},
+ /**
+ * @returns {boolean}
+ */
+ hasMessages: function () {
+ return !_.isEmpty(this.getMessages());
+ },
});
return AbstractThread;