[IMP] mail: add empty message (@ and #)

closes odoo/odoo#74933

Task-id: 2622240
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
This commit is contained in:
Francois (fge)
2021-08-26 13:56:14 +00:00
parent dca9ca6464
commit 4500a72c1c
3 changed files with 11 additions and 12 deletions
@@ -4,4 +4,4 @@ import { registry } from "@web/core/registry";
import { _lt } from "@web/core/l10n/translation";
const commandCategoryRegistry = registry.category("command_categories");
commandCategoryRegistry.add("mail", { label: _lt("Discuss") }, { sequence: 20 });
commandCategoryRegistry.add("mail", {}, { sequence: 20 });
@@ -1,5 +1,6 @@
/** @odoo-module */
import { _lt } from "@web/core/l10n/translation";
import { registry } from "@web/core/registry";
const { Component } = owl;
@@ -13,10 +14,13 @@ DialogCommand.template = xml`
</div>
`;
const commandProviderRegistry = registry.category("command_provider");
const commandEmptyMessageRegistry = registry.category("command_empty_list");
commandEmptyMessageRegistry.add("@", _lt("No user found"));
commandEmptyMessageRegistry.add("#", _lt("No channel found"));
const commandProviderRegistry = registry.category("command_provider");
commandProviderRegistry.add("partner", {
nameSpace: "@",
namespace: "@",
async provide(newEnv, options) {
const messaging = await Component.env.services.messaging.get();
const suggestions = [];
@@ -43,7 +47,7 @@ commandProviderRegistry.add("partner", {
});
commandProviderRegistry.add("channel", {
nameSpace: "#",
namespace: "#",
async provide(newEnv, options) {
const messaging = await Component.env.services.messaging.get();
const channels = await messaging.models['mail.thread'].searchChannelsToOpen({
@@ -2,6 +2,7 @@
import { afterEach, afterNextRender, beforeEach, start } from '@mail/utils/test_utils';
import { click, nextTick, patchWithCleanup, triggerHotkey } from "@web/../tests/helpers/utils";
import { editSearchBar } from '@web/../tests/webclient/commands/command_service_tests';
import { browser } from '@web/core/browser/browser';
import { registry } from "@web/core/registry";
import { commandService } from "@web/webclient/commands/command_service";
@@ -49,10 +50,7 @@ QUnit.module('mail', {}, function () {
await nextTick();
// Switch to partners
const search = webClient.el.querySelector(".o_command_palette_search input");
search.value = "@";
search.dispatchEvent(new InputEvent("input"));
await nextTick();
await editSearchBar("@");
assert.deepEqual(
[...webClient.el.querySelectorAll(".o_command_palette .o_command")].map((el) => el.textContent),
[
@@ -91,10 +89,7 @@ QUnit.module('mail', {}, function () {
await nextTick();
// Switch to channels
const search = webClient.el.querySelector(".o_command_palette_search input");
search.value = "#";
search.dispatchEvent(new InputEvent("input"));
await nextTick();
await editSearchBar("#");
assert.deepEqual(
[...webClient.el.querySelectorAll(".o_command_palette .o_command")].map((el) => el.textContent),
[