[FIX] mail: show group chat in messaging menu

part of task-2634175

closes odoo/odoo#77014

X-original-commit: f37de5ce6fb0e9e7adf50b409c7a5416467396fd
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
Signed-off-by: Phenix <phenix-factory@users.noreply.github.com>
This commit is contained in:
Didier (did)
2021-09-23 07:17:56 +00:00
parent 5c78793a75
commit 2750c09548
3 changed files with 31 additions and 9 deletions
@@ -1039,6 +1039,35 @@ QUnit.test('respond to notification prompt (denied)', async function (assert) {
);
});
QUnit.test('Group chat should be displayed inside the chat section of the messaging menu', async function (assert) {
assert.expect(1);
this.data['mail.channel'].records.push({
id: 11,
channel_type: 'group',
is_pinned: true,
});
await this.start();
await afterNextRender(() =>
document.querySelector('.o_MessagingMenu_toggler').click()
);
await afterNextRender(() =>
document.querySelector(`.o_MessagingMenu_tabButton[data-tab-id="chat"]`).click()
);
assert.strictEqual(
document.querySelectorAll(`
.o_MessagingMenu_dropdownMenu
.o_ThreadPreview[data-thread-local-id="${this.messaging.models['mail.thread'].findFromIdentifyingData({
id: 11,
model: 'mail.channel',
}).localId}"]`).length,
1,
"should have one preview of group"
);
});
});
});
});
@@ -1460,7 +1460,7 @@ function factory(dependencies) {
* @returns {boolean}
*/
_computeIsChatChannel() {
return this.channel_type === 'chat';
return this.channel_type === 'chat' || this.channel_type === 'group';
}
/**
@@ -1780,23 +1780,16 @@ MockServer.include({
_mockResPartner_GetChannelsAsMember(ids) {
const partner = this._getRecords('res.partner', [['id', 'in', ids]])[0];
const channels = this._getRecords('mail.channel', [
['channel_type', '=', 'channel'],
['channel_type', 'in', ['channel', 'group']],
['members', 'in', partner.id],
['public', 'in', ['public', 'groups']],
]);
const directMessages = this._getRecords('mail.channel', [
['channel_type', '=', 'chat'],
['is_pinned', '=', true],
['members', 'in', partner.id],
]);
const privateGroups = this._getRecords('mail.channel', [
['channel_type', '=', 'channel'],
['members', 'in', partner.id],
['public', '=', 'private'],
]);
return [
...channels,
...privateGroups,
...directMessages,
];
},