summaryrefslogtreecommitdiff
path: root/addons/mail/static/src/js/thread_widget.js
diff options
context:
space:
mode:
authorAlexandre Kühn <aku@odoo.com>2018-07-04 15:57:03 +0200
committerAlexandre Kühn <aku@odoo.com>2018-07-19 13:58:34 +0200
commit915da49d173e9ab8d0c6d94cbeec124c83d23fc7 (patch)
treed7fe30d4a4c7f1a6923b88c91ac98582ee6500f4 /addons/mail/static/src/js/thread_widget.js
parentec8c505bc1c9ec21939e9ffef53a9cc6f63f30c7 (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/thread_widget.js')
-rw-r--r--addons/mail/static/src/js/thread_widget.js18
1 files changed, 9 insertions, 9 deletions
diff --git a/addons/mail/static/src/js/thread_widget.js b/addons/mail/static/src/js/thread_widget.js
index 78efdcde707..65fb90fb35a 100644
--- a/addons/mail/static/src/js/thread_widget.js
+++ b/addons/mail/static/src/js/thread_widget.js
@@ -124,7 +124,7 @@ var ThreadWidget = Widget.extend({
// dict where key is message ID, and value is whether it should hide
// the author of message or not visually
- var hideAuthorMessages = {};
+ var displayAuthorMessages = {};
// Hide avatar and info of a message if that message and the previous
// one are both comments wrote by the same author at the same minute
@@ -154,16 +154,15 @@ var ThreadWidget = Widget.extend({
)
)
) {
- hideAuthorMessages[message.getID()] = false;
+ displayAuthorMessages[message.getID()] = true;
} else {
- hideAuthorMessages[message.getID()] = options.squashCloseMessages;
+ displayAuthorMessages[message.getID()] = !options.squashCloseMessages;
}
prevMessage = message;
});
this.$el.html(QWeb.render('mail.widget.Thread', {
thread: thread,
- hideAuthorMessages: hideAuthorMessages,
- // messages: messages,
+ displayAuthorMessages: displayAuthorMessages,
options: options,
ORDER: ORDER,
dateFormat: time.getLangDatetimeFormat(),
@@ -207,17 +206,18 @@ var ThreadWidget = Widget.extend({
* Removes a message and re-renders the thread
*
* @param {integer} [messageID] the id of the removed message
- * @param {mail.model.AbstractMessage[]} [messages] the list of messages to
- * display, without the removed one
+ * @param {mail.model.AbstractThread} thread the thread which contains
+ * updated list of messages (so it does not contain any message with ID
+ * `messageID`).
* @param {Object} [options] options for the thread rendering
*/
- removeMessageAndRender: function (messageID, messages, options) {
+ removeMessageAndRender: function (messageID, thread, options) {
var self = this;
var done = $.Deferred();
this.$('.o_thread_message[data-message-id="' + messageID + '"]')
.fadeOut({
done: function () {
- self.render(messages, options);
+ self.render(thread, options);
done.resolve();
},
duration: 200,