[FIX] mail: fix traceback on emoji
Before this commit: When trying to select emoji on log note before record creation, it shows traceback. After this commit: Hiding the emoji button when the record is under creation. Task-2664700 closes odoo/odoo#80352 X-original-commit: 10c06f9753540d0a58b1a93fc54947a58b092468 Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
This commit is contained in:
committed by
Sébastien Theys
parent
1d22af0a75
commit
8f546bfad1
@@ -91,7 +91,7 @@ QUnit.test('base rendering when chatter has no attachment', async function (asse
|
||||
});
|
||||
|
||||
QUnit.test('base rendering when chatter has no record', async function (assert) {
|
||||
assert.expect(8);
|
||||
assert.expect(10);
|
||||
|
||||
await this.start();
|
||||
const chatter = this.messaging.models['mail.chatter'].create({
|
||||
@@ -138,6 +138,20 @@ QUnit.test('base rendering when chatter has no record', async function (assert)
|
||||
'.o_MessageList_loadMore',
|
||||
"should not have the 'load more' button"
|
||||
);
|
||||
|
||||
await afterNextRender(() =>
|
||||
document.querySelector('.o_Message').click()
|
||||
);
|
||||
assert.strictEqual(
|
||||
document.querySelectorAll(`.o_MessageActionList`).length,
|
||||
1,
|
||||
"should action list in message"
|
||||
);
|
||||
assert.containsNone(
|
||||
document.body,
|
||||
'.o_MessageActionList_action',
|
||||
"should not have any action in action list of message"
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test('base rendering when chatter has attachments', async function (assert) {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<t t-name="mail.MessageActionList" owl="1">
|
||||
<div class="o_MessageActionList d-flex" t-on-click="messageActionList and messageActionList.onClick" t-ref="root">
|
||||
<t t-if="messageActionList">
|
||||
<Popover class="o_MessageActionList_action o_MessageActionList_actionReaction p-2 fa fa-lg fa-smile-o" position="'top'" titleAttribute="ADD_A_REACTION" t-on-o-emoji-selection="messageActionList.onEmojiSelection" t-on-o-popover-closed="messageActionList.onReactionPopoverClosed" t-on-o-popover-opened="messageActionList.onReactionPopoverOpened" t-ref="reactionPopover">
|
||||
<Popover t-if="messageActionList.message.hasReactionIcon" class="o_MessageActionList_action o_MessageActionList_actionReaction p-2 fa fa-lg fa-smile-o" position="'top'" titleAttribute="ADD_A_REACTION" t-on-o-emoji-selection="messageActionList.onEmojiSelection" t-on-o-popover-closed="messageActionList.onReactionPopoverClosed" t-on-o-popover-opened="messageActionList.onReactionPopoverOpened" t-ref="reactionPopover">
|
||||
<t t-set="opened">
|
||||
<EmojisPopover/>
|
||||
</t>
|
||||
|
||||
@@ -364,6 +364,12 @@ registerModel({
|
||||
_computeFailureNotifications() {
|
||||
return replace(this.notifications.filter(notifications => notifications.isFailure));
|
||||
},
|
||||
/**
|
||||
* @returns {boolean}
|
||||
*/
|
||||
_computeHasReactionIcon() {
|
||||
return !this.isTemporary && !this.isTransient;
|
||||
},
|
||||
/**
|
||||
* @private
|
||||
* @returns {boolean}
|
||||
@@ -578,6 +584,12 @@ registerModel({
|
||||
guestAuthor: many2one('mail.guest', {
|
||||
inverse: 'authoredMessages',
|
||||
}),
|
||||
/**
|
||||
* Determines whether the message has a reaction icon.
|
||||
*/
|
||||
hasReactionIcon: attr({
|
||||
compute: '_computeHasReactionIcon',
|
||||
}),
|
||||
id: attr({
|
||||
readonly: true,
|
||||
required: true,
|
||||
|
||||
Reference in New Issue
Block a user