diff options
| author | Alexandre Kühn <aku@odoo.com> | 2018-07-04 15:57:03 +0200 |
|---|---|---|
| committer | Alexandre Kühn <aku@odoo.com> | 2018-07-19 13:58:34 +0200 |
| commit | 915da49d173e9ab8d0c6d94cbeec124c83d23fc7 (patch) | |
| tree | d7fe30d4a4c7f1a6923b88c91ac98582ee6500f4 /addons/mail/static/src/js/models/threads/mailbox.js | |
| parent | ec8c505bc1c9ec21939e9ffef53a9cc6f63f30c7 (diff) | |
[IMP] mail, *: template rendering with abstract thread, adapt thread instantiation, thread `getMessages`/`fetchMessages`, and create mode document thread.
* = im_livechat, im_support
- thread widget now uses abstract thread in `render` method
- thread models have their `init` parameters changed, so that the parent may be optional
- reworked 'creating a new record...' in chatter in create mode:
> new model CreateModeDocumentThread, which basically is a fake document thread
with a fake message for its rendering in create mode of the chatter
> special rendering method of thread_widget for such case: `renderChatterCreateMode`
- renamed thread methods previously named `getMessages` to `fetchMessages`:
> in order to not conflict with `getMessages`, used for rendering
> now, `getMessages` always get messages that are locally,
while `fetchMessages` may fetch messages.
TODO:
- special thread model for im_livechat (rendering is broken ATM)
Diffstat (limited to 'addons/mail/static/src/js/models/threads/mailbox.js')
| -rw-r--r-- | addons/mail/static/src/js/models/threads/mailbox.js | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/addons/mail/static/src/js/models/threads/mailbox.js b/addons/mail/static/src/js/models/threads/mailbox.js index bcb5ae609b7..6d2e75c59b1 100644 --- a/addons/mail/static/src/js/models/threads/mailbox.js +++ b/addons/mail/static/src/js/models/threads/mailbox.js @@ -18,13 +18,15 @@ var Mailbox = ThreadWithCache.extend({ /** * @override - * @param {Object} data - * @param {string} data.id the ID of the mailbox, without the 'mailbox_' - * prefix. - * @param {integer} [data.mailboxCounter=0] the initial mailbox counter of - * this mailbox. + * @param {Object} params + * @param {Object} params.data + * @param {string} params.data.id the ID of the mailbox, without the + * 'mailbox_' prefix. + * @param {integer} [params.data.mailboxCounter=0] the initial mailbox + * counter of this mailbox. */ - init: function (parent, data) { + init: function (params) { + var data = params.data; // ID or mailboxes are always prefixed with 'mailbox_' data.id = 'mailbox_' + data.id; data.type = 'mailbox'; @@ -89,7 +91,7 @@ var Mailbox = ThreadWithCache.extend({ getMessagePreviews: function () { var self = this; - return this.getMessages().then(function (messages) { + return this.fetchMessages().then(function (messages) { // pick only last message of chatter // items = list of objects // { unreadCounter: integer, message: mail.model.Message } |
