Skip to content
Permalink
Browse files

[IMP] mail: Improve the document chat window

On Hover the systray, add 'expand' icon, it directly open the form view.

Delete the name of the task on all messages: only keep it in the header of the chat window.
For messages on praticular document do not diplay the Document Links in chatter window.

Task:1929169

closes #30957
  • Loading branch information...
ppr-odoo committed Feb 22, 2019
1 parent 31983e0 commit 3e353eb7910e114e2a9dd8f615f38bfb01ca6485
@@ -260,6 +260,7 @@ var Message = AbstractMessage.extend(Mixins.EventDispatcherMixin, ServicesMixin
messageID: this.getID(),
status: this.status,
title: title,
isLinkedToDocumentThread: this.isLinkedToDocumentThread(),
};
},
/**
@@ -24,6 +24,7 @@ var MessagingMenu = Widget.extend({
'click .o_filter_button': '_onClickFilterButton',
'click .o_new_message': '_onClickNewMessage',
'click .o_mail_preview_mark_as_read': '_onClickPreviewMarkAsRead',
'click .o_thread_window_expand': '_onClickExpand',
'show.bs.dropdown': '_onShowDropdown',
},
/**
@@ -246,6 +247,19 @@ var MessagingMenu = Widget.extend({
_onShowDropdown: function () {
this._updatePreviews();
},
/**
* When a expand is clicked on, we want to open the related object
*
* @private
* @param {MouseEvent} ev
*/
_onClickExpand: function (ev) {
ev.stopPropagation();
var $preview = $(ev.currentTarget).closest('.o_mail_preview');
var documentModel = $preview.data('documentModel');
var documentID = $preview.data('documentId');
this._openDocument(documentModel, documentID);
},
/**
* @private
* @param {MouseEvent} ev
@@ -77,11 +77,14 @@ var AbstractThreadWindow = Widget.extend({
var self = this;
this.$input = this.$('.o_composer_text_field');
this.$header = this.$('.o_thread_window_header');

this._threadWidget = new ThreadWidget(this, {
displayMarkAsRead: false,
displayStars: this.options.displayStars,
});
var options = {
displayMarkAsRead: false,
displayStars: this.options.displayStars,
};
if (this._thread && this._thread._type === 'document_thread') {
options.displayDocumentLinks = false;
}
this._threadWidget = new ThreadWidget(this, options);

// animate the (un)folding of thread windows
this.$el.css({transition: 'height ' + this.FOLD_ANIMATION_DURATION + 'ms linear'});
@@ -75,6 +75,9 @@ $o-mail-thread-window-zindex: $zindex-modal + 1 !default;
margin-left: 5px;
@include o-hover-opacity(0.7, 1);
}
.o_thread_window_expand {
opacity: 0;
}
}

}
@@ -362,6 +362,7 @@
flex: 1 1 100%;
overflow: hidden;
.o_preview_title {
align-items: center;
display: flex;
.o_preview_name {
flex: 0 1 auto;
@@ -378,7 +379,11 @@
padding-right: 0px;
}
.o_preview_counter {
flex: 0 1 auto;
}
.o_preview_expand {
flex: 1 1 auto;
margin: 0px 6px;
}
.o_last_message_date {
flex: 0 0 auto;
@@ -316,6 +316,7 @@
<span class="o_preview_counter">
<t t-if="preview.unreadCounter &gt; 0">&amp;nbsp;(<t t-esc="preview.unreadCounter"/>)</t>
</span>
<span class="o_preview_expand o_discuss_icon o_thread_window_expand fa fa-expand" t-if="preview.isLinkedToDocumentThread"/>
<span class="o_last_message_date"> <t t-esc="preview.date ? preview.date.fromNow() : ''"/> </span>
</div>
<div class="o_last_message_preview">
@@ -881,5 +881,48 @@ QUnit.test('messaging menu widget: do not open chat window twice on preview clic
messagingMenu.destroy();
});

QUnit.test('messaging menu widget: expand on thread preview', async function (assert) {
assert.expect(4);

var taskMessage = [{
author_id: [1, "Demo"],
body: "<p>Office Design Project</p>",
res_id: 123,
model: 'some.res.model',
needaction: true,
needaction_partner_ids: [44],
}];
this.data['mail.message'].records =
this.data['mail.message'].records.concat(taskMessage);

var messagingMenu = new MessagingMenu();
testUtils.mock.addMockEnvironment(messagingMenu, {
services: this.services,
data: this.data,
session: {
partner_id: 44,
},
intercepts: {
do_action: function (ev) {
if (ev.data.action.res_model === 'some.res.model' &&
ev.data.action.res_id === 123
) {
assert.step('open_document');
}
},
},
});
await messagingMenu.appendTo($('#qunit-fixture'));

await testUtils.dom.click(messagingMenu.$('.dropdown-toggle'));

var $preview = messagingMenu.$('.o_mail_preview');
assert.containsOnce(messagingMenu, '.o_thread_window_expand', "should display one preview");
assert.strictEqual($preview.data('document-model'), "some.res.model", "preview should be from some.res.model");
await testUtils.dom.click($preview.find('.o_thread_window_expand'));
assert.verifySteps(['open_document']);
messagingMenu.destroy();
});

});
});

0 comments on commit 3e353eb

Please sign in to comment.
You can’t perform that action at this time.