Commit Graph
17 Commits
Author SHA1 Message Date
Sébastien Theys 7ea370fce7 [REF] mail, *: tests: refactor contains to further remove jQuery
* = account, base_iban, bus, calendar, crm_livechat, hr, hr_holidays,
    im_livechat, mrp, project, sms, snailmail, test_mail,
    test_mail_full, web, website_livechat, website_slides

Add support in `contains` for most operations that we use in tests.
Remove return value from `contains`.
Move into `web` module.
Remove import/export chains, directly import from correct module.

closes odoo/odoo#134652

Related: odoo/enterprise#47064
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2023-09-14 11:22:47 +00:00
tsm-odoo a188d9c894 [IMP] im_livechat, *: use guests for livechat visitors
*: crm_livechat, mail, test_discuss_full, website_livechat.

part of task-3332628

closes odoo/odoo#129770

Related: odoo/enterprise#45767
Signed-off-by: Matthieu Stockbauer (tsm) <tsm@odoo.com>
2023-09-07 13:10:07 +00:00
Sébastien Theys e3b774118b [REF] mail, *: tests: remove most remaining afterNextRender
* = base_iban, bus, calendar, crm_livechat, im_livechat

Follow up of https://github.com/odoo/odoo/pull/130451

`contains` is faster and functionally more significant.

Part-of: odoo/odoo#134025
2023-09-04 21:53:37 +00:00
Sébastien Theys 811f159f18 [REF] mail, *: tests: replace remaining jQuery text() occurrences
* = im_livechat, snailmail, test_mail, website_livechat

And also `innerText`.

closes odoo/odoo#133717

Related: odoo/enterprise#46603
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-09-01 13:21:01 +00:00
Sébastien Theys 3ce461cc51 [REF] mail, *: move contains count to named parameter
* = calendar, hr, im_livechat, mrp, project_todo, sms, snailmail,
    test_mail

The parameter is too often specified with its default value to be worth
being a positional parameter.

Part-of: odoo/odoo#133717
2023-09-01 13:21:01 +00:00
Sébastien Theys 78897c1890 [REF] mail, *: tests: use native code for most contains/text
* = calendar, im_livechat, project_todo, sms, snailmail, test_mail,
    website_slides

The choice was made to have "trimmed text" check rather than "contains"
to have more robust tests, at the cost of slightly more effort to write
complete and unique asserts.

There is no direct speed improvement from this one, but it is one step
closer to removing jQuery.

Moreover, it will fix infinite loops in some situations, because jQuery
selectors would write attributes on the body, which would trigger the
mutation observer, which itself will call the selector again.

Part-of: odoo/odoo#133717
2023-09-01 13:21:01 +00:00
Sébastien Theys a7485e53d6 [REF] mail, *: clean click and contains API
* = test_mail, hr, im_livechat

- Allow only selectors
- Add `value` check to `contains`
- Remove return from `click`

closes odoo/odoo#132799

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-08-23 17:40:07 +02:00
Sébastien Theys d08a18b791 [IMP] mail, *: tests: use contains in click and insertText
* = account, calendar, im_livechat, mrp, project_todo, sms, snailmail,
    test_mail, web, website_livechat

`contains` is more efficient than `afterNextRender` as it does not wait
for several extra animation frames, and it is functionally more
meaningful.

closes odoo/odoo#130451

Related: odoo/enterprise#44999
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-08-21 21:00:03 +02:00
tsm-odoo 7131f7c626 [IMP] mail, *: add support for guests/dynamic users in tests
*: bus, calendar, im_livechat, web, website_livechat.

This PR adds the possibility to set the current user during tests as
well as the mail guest. This will be used to test mail guest page and
livechat once the visitors will be treated as guests.

part of task-3332628

closes odoo/odoo#130811

Related: odoo/enterprise#45331
Signed-off-by: Matthieu Stockbauer (tsm) <tsm@odoo.com>
2023-08-09 14:36:12 +02:00
Alexandre Kühn e228acb081 [REV] mail: debounce suggestion (and channel selector) searches
This reverts odoo#126869.

Motivation for debounce was to reduce the amount of RPCs, to
not put too much load on server.

However, this makes showing of mention slower than it should,
and the load on server is already adjusted based on duration
of ongoing `fetchSuggestion` RPC: if server can reply with mentions
immediately, then no need to debounce. If the RPC is slow, then
next `fetchSuggestion` waits for current RPC to finish before
making a new fetch.

This PR also fixes this small crash when using mentions:

```
TypeError: Cannot read properties of undefined (reading 'toLowerCase')
    at cleanTerm (format.js:244:1) (/mail/static/src/utils/format.js:244)
```

Steps to reproduce:
- type `@` then `backspace` then `@` then `backspace`, etc.

This happened because suggestion hook internal state had `term` being undefined when there is no term, but `undefined` is invalid for `cleanTerm`. `""` is a better default for no search term, and since this is a string this works with `cleanTerm`.

closes odoo/odoo#127399

Related: odoo/enterprise#43678
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-07-05 18:46:42 +02:00
Sanjay-Sharma 4f6a92e684 [IMP] web_editor: add emoji picker in web editor
Purpose:

This commit adds Emoji_picker functionality to the web_editor,
allowing users to conveniently add emojis to their text and
improving the overall user experience.

Specifications:

Now we can insert emoji in web_editor using `/emoji`.

Task id: 3253958

closes odoo/odoo#125137

Related: odoo/enterprise#42772
Signed-off-by: Simon Genin (ges@odoo) <ges@odoo.com>
2023-07-05 11:37:06 +02:00
Alexandre Kühn 987eeef710 [FIX] mail: debounce suggestion (and channel selector) searches
Before this commit, fetching suggestions (e.g. channel selector
in discuss sidebar "Find or create a channel", or `@`-mentions)
were performing RPCs on each user input, resulting in wasted
network and server load.

This commit fixes the issue by debouncing the fetching of
suggestions to 0.5 sec.

closes odoo/odoo#126952

X-original-commit: 6770ac3
Related: odoo/enterprise#43502
Signed-off-by: Matthieu Stockbauer (tsm) <tsm@odoo.com>
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-07-04 03:43:48 +02:00
Sébastien Theys 9dba4e0d77 [REF] mail, *: reorganize JS files
Remove "fake" feature sub-folders that make files harder to find.

Note: If there are too many files in the main folder now, a new split
that actually makes sense can be done at a later time: this would not
just be code move, but removing coupling between said feature and the
rest of the code.

Apply consistent structure, where the top level folder is a feature (or
core), and sub-folders are subdivision of the feature depending on
context (closely related to assets bundles).

```
- core
    - common
    - public
    - web
- feature
    - common
    - public
    - web
```

The opportunity is taken to reorganize the top of the files and imports:
- Always use absolute path in imports to be able to find all usages of a
  file with a single search.
- Reorganize imports to group them by module, and to sort them
  alphabetically by path/feature.
- Always use single asterisk (*) for `odoo-module`: less characters yay!
  And double asterisk should be used for JSDoc comments, not for custom
  instructions.

Part of task-3265211

closes odoo/odoo#124168

Related: odoo/enterprise#42121
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2023-06-08 21:52:44 +02:00
Sébastien Theys 7e0c68bf2b [REF] mail, im_livechat: move typing to discuss WIP
closes odoo/odoo#120851

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-05-11 12:01:43 +02:00
Sébastien Theys 90cb44e1e1 [REF] mail, *: rename mail.channel to discuss.channel
* = bus, calendar, crm_livechat, hr, hr_holidays, im_livechat, mail_bot,
    mass_mailing, privacy_lookup, test_discuss_full, test_mail,
    test_mail_full, website_crm_livechat, website_livechat, base

In preparation of splitting discuss and mail modules.

Part of task-3265211

closes odoo/odoo#118354

Related: odoo/upgrade#4553
Related: odoo/enterprise#39661
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2023-04-21 02:21:53 +02:00
Zelong Lin 6705c2f4fd [IMP] mail,im_livechat: no canned reply in mail
Canned response should only enabled in livechat thread.
task-3208438

closes odoo/odoo#116388

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-04-11 18:49:24 +02:00
7710c3331e [REF] mail, *: refactor Discuss
This commit refactors discuss code to use OWL components
and new tools and services in web/.
Functionally, Discuss app should work relatively the same as
before this commit.

closes https://github.com/odoo/odoo/pull/110188

Related:
https://github.com/odoo/enterprise/pull/38058
https://github.com/odoo/upgrade/pull/4423

closes odoo/odoo#110188

Related: odoo/upgrade#4423
Related: odoo/enterprise#38058
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Co-authored-by: Alexandre (aku) <aku@odoo.com>
Co-authored-by: Didier (did) <did@odoo.com>
Co-authored-by: Géry (ged) <ged@odoo.com>
Co-authored-by: Louis (wil) <wil@odoo.com>
Co-authored-by: Maël (mapa) <mapa@odoo.com>
Co-authored-by: Maryam (maki) <maki@odoo.com>
Co-authored-by: Sébastien (seb) <seb@odoo.com>
Co-authored-by: Thanh (tso) <tso@odoo.com>
Co-authored-by: Matthieu (tsm) <tsm@odoo.com>
Co-authored-by: Zelong (zel) <zel@odoo.com>
2023-03-17 11:47:09 +01:00