[IMP] mail: do not exclude self from partner search

Do not exclude the current partner from the partner search so that you
can easily start a chat with yourself.

Task-2844917

closes odoo/odoo#90663

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
This commit is contained in:
Louis Wicket (wil)
2022-05-06 13:30:12 +02:00
parent c8ef8fd737
commit e5d33096fc
2 changed files with 1 additions and 24 deletions
-2
View File
@@ -181,11 +181,9 @@ registerModel({
// prefetched partners
let partners = [];
const cleanedSearchTerm = cleanSearchTerm(keyword);
const currentPartner = this.messaging.currentPartner;
for (const partner of this.all(partner => partner.active)) {
if (partners.length < limit) {
if (
partner !== currentPartner &&
partner.name &&
partner.user &&
cleanSearchTerm(partner.name).includes(cleanedSearchTerm)
@@ -24,19 +24,7 @@ QUnit.module('mail', {}, function () {
});
QUnit.test('open the chatWindow of a user from the command palette', async function (assert) {
assert.expect(3);
const pyEnv = await startServer();
const [resPartnerId1, resPartnerId2, resPartnerId3] = pyEnv['res.partner'].create([
{ name: "Partner 1", email: "p1@odoo.com" },
{ name: "Partner 2", email: "p2@odoo.com" },
{ name: "Partner 3", email: "p3@odoo.com" },
]);
pyEnv['res.users'].create([
{ name: "User 1", partner_id: resPartnerId1 },
{ name: "User 2", partner_id: resPartnerId2 },
{ name: "User 3", partner_id: resPartnerId3 },
]);
assert.expect(1);
const target = getFixture();
await start({
@@ -48,18 +36,9 @@ QUnit.module('mail', {}, function () {
// Switch to partners
await editSearchBar("@");
assert.deepEqual(
[...target.querySelectorAll(".o_command_palette .o_command")].map((el) => el.textContent),
[
"Partner 1p1@odoo.com",
"Partner 2p2@odoo.com",
"Partner 3p3@odoo.com",
]
);
await afterNextRender(() => click(document.body, ".o_command.focused"));
assert.containsOnce(document.body, ".o_ChatWindow");
assert.strictEqual(document.querySelector(".o_ChatWindow .o_ChatWindowHeader_name").textContent, "Partner 1");
});
QUnit.test('open the chatWindow of a channel from the command palette', async function (assert) {