[FIX] mail: clean docstring
- updated docstring - move function to abstract thread (generalization behaviour for all threads) - simplify code
This commit is contained in:
@@ -8,24 +8,27 @@ var AbstractThread = require('mail.model.AbstractThread');
|
||||
* is not linked to the mail service.
|
||||
*/
|
||||
var WebsiteLivechat = AbstractThread.extend({
|
||||
|
||||
/**
|
||||
* @param {Object} livechatData
|
||||
* @param {boolean} [livechatData.folded] states whether the livechat is
|
||||
* @override
|
||||
* @private
|
||||
* @param {Object} params
|
||||
* @param {Object} params.data
|
||||
* @param {boolean} [params.data.folded] states whether the livechat is
|
||||
* folded or not. It is considered only if this is defined and it is a
|
||||
* boolean value.
|
||||
* @param {integer} livechatData.id the ID of this livechat.
|
||||
* @param {integer} [livechatData.message_unread_counter=undefined] the
|
||||
* boolean.
|
||||
* @param {integer} params.data.id the ID of this livechat.
|
||||
* @param {integer} [params.data.message_unread_counter=undefined] the
|
||||
* unread counter of this livechat.
|
||||
* @param {Array} livechatData.operator_pid
|
||||
* @param {string} livechatData.name the name of this livechat.
|
||||
* @param {string} [livechatData.state] if 'folded', the livechat is folded.
|
||||
* @param {Array} params.data.operator_pid
|
||||
* @param {string} params.data.name the name of this livechat.
|
||||
* @param {string} [params.data.state] if 'folded', the livechat is folded.
|
||||
* This is ignored if `folded` is provided and is a boolean value.
|
||||
* @param {string} livechatData.uuid the UUID of this livechat.
|
||||
* @param {string} params.data.uuid the UUID of this livechat.
|
||||
*/
|
||||
init: function (livechatData) {
|
||||
var params = { data: livechatData };
|
||||
|
||||
this._super(params);
|
||||
this._super.call(this, params);
|
||||
|
||||
this._operatorPID = livechatData.operator_pid;
|
||||
this._uuid = livechatData.uuid;
|
||||
@@ -45,12 +48,6 @@ var WebsiteLivechat = AbstractThread.extend({
|
||||
// Public
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* @param {boolean} folded
|
||||
*/
|
||||
fold: function (folded) {
|
||||
this._folded = folded;
|
||||
},
|
||||
/**
|
||||
* @override
|
||||
* @returns {im_livechat.model.WebsiteLivechatMessage[]}
|
||||
|
||||
@@ -20,7 +20,9 @@ var _t = core._t;
|
||||
* mail.model.ThreadWithCache
|
||||
*/
|
||||
var SupportChannel = ThreadWithCache.extend({
|
||||
|
||||
/**
|
||||
* @override
|
||||
* @param {Object} params
|
||||
* @param {Object} params.data
|
||||
* @param {boolean} params.data.available
|
||||
|
||||
@@ -29,6 +29,14 @@ var AbstractThread = Class.extend({
|
||||
// Public
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Updates the folded state of the thread
|
||||
*
|
||||
* @param {boolean} folded
|
||||
*/
|
||||
fold: function (folded) {
|
||||
this._folded = folded;
|
||||
},
|
||||
/**
|
||||
* Get the ID of this thread
|
||||
*
|
||||
|
||||
@@ -79,11 +79,6 @@ var DM = Channel.extend({
|
||||
args: [this.getUUID(), false],
|
||||
});
|
||||
},
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Private
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
});
|
||||
|
||||
return DM;
|
||||
|
||||
@@ -319,7 +319,6 @@ var DocumentThread = Thread.extend({
|
||||
|
||||
});
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
return DocumentThread;
|
||||
|
||||
@@ -207,7 +207,6 @@ var Mailbox = ThreadWithCache.extend({
|
||||
throw _t(_.str("Missing domain for mailbox with ID '%s'", this._id));
|
||||
}
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
return Mailbox;
|
||||
|
||||
@@ -16,20 +16,20 @@ var ServicesMixin = require('web.ServicesMixin');
|
||||
* In particular, channels and mailboxes are two different kinds of threads.
|
||||
*/
|
||||
var Thread = AbstractThread.extend(Mixins.EventDispatcherMixin, ServicesMixin, {
|
||||
|
||||
/**
|
||||
* @override
|
||||
* @param {Object} params
|
||||
* @param {mail.Manager} param.parent
|
||||
* @param {Object} params
|
||||
* @param {Object} params.data
|
||||
* @param {string} [params.data.channel_type]
|
||||
* @param {string} params.data.name
|
||||
* @param {string} [params.data.type]
|
||||
*/
|
||||
init: function (params) {
|
||||
this._super.apply(this, arguments);
|
||||
Mixins.EventDispatcherMixin.init.call(this, arguments);
|
||||
this.setParent(params.parent);
|
||||
|
||||
this._super.apply(this, arguments);
|
||||
// threads are not detached by default
|
||||
this._detached = false;
|
||||
// if this._massMailing is set, display subject on messages, use
|
||||
@@ -100,14 +100,15 @@ var Thread = AbstractThread.extend(Mixins.EventDispatcherMixin, ServicesMixin, {
|
||||
return $.when([]);
|
||||
},
|
||||
/**
|
||||
* Updates the _folded state of the thread. Must be overriden to reflect
|
||||
* Updates the folded state of the thread. Must be overriden to reflect
|
||||
* the new state in the interface.
|
||||
*
|
||||
* @override
|
||||
* @param {boolean} boolean
|
||||
*/
|
||||
fold: function (folded) {
|
||||
this._detached = true;
|
||||
this._folded = folded;
|
||||
this._super.apply(this, arguments);
|
||||
this._detached = true; // auto-detach the thread
|
||||
this._warnUpdatedWindowState();
|
||||
},
|
||||
/**
|
||||
@@ -300,8 +301,7 @@ var Thread = AbstractThread.extend(Mixins.EventDispatcherMixin, ServicesMixin, {
|
||||
*/
|
||||
markAsRead: function () {
|
||||
if (this._unreadCounter > 0) {
|
||||
this._unreadCounter = 0;
|
||||
this._warnUpdatedUnreadCounter();
|
||||
this.resetUnreadCounter();
|
||||
}
|
||||
return $.when();
|
||||
},
|
||||
|
||||
@@ -14,6 +14,7 @@ var session = require('web.session');
|
||||
* in order to make searches on messages in a thread.
|
||||
*/
|
||||
var ThreadWithCache = Thread.extend({
|
||||
|
||||
/**
|
||||
* @override
|
||||
* @param {Object} params
|
||||
|
||||
Reference in New Issue
Block a user