Commit Graph
414 Commits
Author SHA1 Message Date
Qiuyu (QHO) bd67479316 [REF] mail, mail_bot, im_livechat, *: convert JS files to ES6 modules
task id: 2487514

closes odoo/odoo#69376

Related: odoo/enterprise#17749
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2021-04-19 13:33:35 +00:00
740168ce8d [REF] web_editor, website_*, mass_mailing: adapt to Odoo Editor
Co-authored-by: David Monjoie <dmo@odoo.com>
Co-authored-by: Antoine Guenet <age@odoo.com>
Co-authored-by: Nicolas Bayet <nby@odoo.com>
Co-authored-by: Sébastien Geelen <sge@odoo.com>
Co-authored-by: Emilien Durieu <edu@odoo.com>
2021-04-01 16:01:06 +00:00
Didier (did) 6fad0e09b1 [FIX] mail: detect a bigger range of URL in messages
Current URL regexp doesn't support special, but still valid, character like `é`,
`è`, `ỗ`, `ặ`, etc.

Url like `https://tenor.com/view/chỗgiặt-dog-smile-gif-13860250` are not going
to be matched correctly.

This commit adds the support for Latin-1 Supplement, Latin Extended-A,
Latin Extended-B and Latin Extended Additional unicode.

Some relevant stackoverflow discussion:
https://stackoverflow.com/questions/20690499/concrete-javascript-regex-for-accented-characters-diacritics

task-2088895

closes odoo/odoo#68670

X-original-commit: 1f9c171115d8bbd81d382e353f3faadab16aedfc
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2021-04-01 18:44:08 +00:00
Xavier DubucandSébastien Theys e3ecccd641 [FIX] mail; hr: restore faster and more accurate mention suggestions
The code from v13 used to look for partners in JS before making the RPC, which
was much faster, and also gave better results by returning partners that were
already known and therefore more likely to be selected.

The same logic is reintroduced here, and further improved to take into account
all known partners and sort them according to the likeliness they will be
selected based on various criteria.

task-2413776

closes odoo/odoo#68045

X-original-commit: 930e090ced8134c3819a5a87b9052467ba23e8e4
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Co-authored-by: Sébastien Theys <seb@odoo.com>
2021-03-18 10:32:27 +00:00
Thibault Delavallée e5338146e7 [REF] mail: make message belongs to a single thread without listener channels
RATIONALE

Channel model is a mail.thread enabled model behaving strangely with followers,
notifications and discuss. Its code should however be simplified to be more
self contained and avoid unwanted side effects on other models.

PURPOSE

Remove channel ability to follow records as it mainly adds noise without a lot
of added value. Simplify channel notification flow by using directly members
and not a delegation through a channel self-following trick. Remove followers
being channels and posting with added listeners being channels.

SPECIFICATIONS

In this commit we force messages to belong to a single document using
``model`` / ``res_id`` pair. It is not possible anymore to link a message
to channels using ``channel_ids``. A message belongs to a document and
is displayed in that document's chatter.

This change implies modifying a lot of domains, notably in chatter. Indeed
discuss for channels does not use ``('channel_ids', 'in', [3])`` domains.
They now use ``('model', '=', 'mail.channel'), ('res_id', 'in', [3])`` like
other documents fetching their messages.

This commit also removes ``channel_message_ids`` field on ``mail.channel``
model. As channels are now considered as standard documents they will use
``message_ids`` field like all other documents. Linking a channel on a message
is possible only as a link in message from now on. It is not possible to push
it into a channel anymore (no more listener channels, no more channel link).

Finally a global cleaning also linked to all previous commits is done.

LINKS

Task ID-2070632 (main task)
Task ID-2419762 (followup task)
COM PR odoo/odoo#62859
ENT PR odoo/enterprise#15172
UPG PR odoo/upgrade#2005
2021-03-17 18:16:35 +00:00
Thibault Delavallée df013e76bc [REF] mail: do not support listener channels when posting a message
RATIONALE

Channel model is a mail.thread enabled model behaving strangely with followers,
notifications and discuss. Its code should however be simplified to be more
self contained and avoid unwanted side effects on other models.

PURPOSE

Remove channel ability to follow records as it mainly adds noise without a lot
of added value. Simplify channel notification flow by using directly members
and not a delegation through a channel self-following trick. Remove followers
being channels and posting with added listeners being channels.

SPECIFICATIONS

In this commit we remove support of ``channel_ids`` parameter when posting
a message. This means we do not support notifying channels as side-part
of notification mechanism on a document. Either we post on a channel and
its members are notified, either we post on a business documents and its
followers are notified. There is no possibility to add channels as being
notified when posting a message.

This is done as a followup of removing followers being channel-based and
prepares ground to make channel use model / res_id as all other documents
inheriting form mail.thread.

LINKS

Task ID-2070632 (main task)
Task ID-2419762 (followup task)
COM PR odoo/odoo#62859
ENT PR odoo/enterprise#15172
UPG PR odoo/upgrade#2005
2021-03-17 18:16:20 +00:00
Thibault Delavallée 4cb1f56aba [REF] mail, sms, test_mail: remove now unused channel_id field on Py and JS follower models
RATIONALE

Channel model is a mail.thread enabled model behaving strangely with followers,
notifications and discuss. Its code should however be simplified to be more
self contained and avoid unwanted side effects on other models.

PURPOSE

Remove channel ability to follow records as it mainly adds noise without a lot
of added value. Simplify channel notification flow by using directly members
and not a delegation through a channel self-following trick. Remove followers
being channels and posting with added listeners being channels.

SPECIFICATIONS

As there is no way to add channel-based follower anymore we can remove all
fields and code supporting this feature. Notably we can remove ``channel_id``
field on ``mail.follower`` model as well all code using it, notably compute
methods.

In this commit we also make ``partner_id`` field required as now followers
are always partners. Email, name and active fields are now simple related
fields on the partner.

Code computing data about subscription is also updated and simplified. As
we do not have channels anymore but only partners all custom SQL queries
are now simplified.

JS models for Discuss are also cleaned. Following python change, JS models
are simplified to match the backend models. Channel_id is removed, partner_id
is now required, and various code is updated according to the simplified
model.

Side note: we could probably get rid of specific index on ``partner_id``
field. However we have to ensure we never search for followers without being
in a model / res_id context. This will be done in another cleaning step to
be sure performance are not broken.

LINKS

Task ID-2070632 (main task)
Task ID-2419762 (followup task)
COM PR odoo/odoo#62859
ENT PR odoo/enterprise#15172
UPG PR odoo/upgrade#2005
2021-03-17 18:16:18 +00:00
Thibault Delavallée 7991118bfe [REF] mail, various: remove support of channels from message_subscribe API
RATIONALE

Channel model is a mail.thread enabled model behaving strangely with followers,
notifications and discuss. Its code should however be simplified to be more
self contained and avoid unwanted side effects on other models.

SPECIFICATIONS

Remove ``channel_ids`` argument and support from ``message_subscribe`` and
``message_unsubscribe`` API. Indeed we do not support adding channel-based
followers anymore. Only partners should be added or removed from followers.
It also allows to simplify API and understanding of both methods.

Various addons are updated to match the simplified (un)subscribe API. Some
enterprise addons may also be impacted.

LINKS

Task ID-2070632 (main task)
Task ID-2419762 (followup task)
COM PR odoo/odoo#62859
ENT PR odoo/enterprise#15172
UPG PR odoo/upgrade#2005
2021-03-17 18:16:11 +00:00
Xavier Dubuc b85bde9854 [FIX] mail: do not show falsy value in tracking values messages
task-2438828

closes odoo/odoo#67227

X-original-commit: 49585b8ee726af7edd113c3012b1168d24dc4d7c
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2021-03-04 12:41:05 +00:00
Damien Abeloos 8aa1d6ff02 [IMP] mail: revamp the activity type form view
* Reorganize and reword some of the fields for the activity form type view

* The fields `force_next` from `mail.activity.type` and its related
  field from `mail.activity` are removed.
  Instead, a new field `chaining_type`, which is a `selection` will
  improve the readability of the activity_type form. (It is made more
  obvious that the user has to choose between 2 modes :
    - 'Trigger Next Activity': used when the user wants to specify the type of the
      next activity, which will be triggered once the current activity is done
    - 'Suggest Next Activity': used when the user wants to recommend the
      next activity for the user to schedule once the current activity is done

* To be consistent with this change :
    - The field `default_next_type_id` is renamed `triggered_next_type_id`
    - The field `next_type_ids` is renamed `suggested_next_type_ids`

* The field `default_description` is renamed `default_note` to better match the
  `note` field from `mail.activity`

* About the specific case of activity_type.category = 'upload_file' :
    An activity which has this type's category is automatically marked as done as soon as
    the file is uploaded. This prevents the user from choosing a "next activity type".

    As such, an activity_type with this category can only make use of the
    chaining_type = "trigger", to be part of an automated process.

    An activity_type with this chaining_type should have the
    triggered_next_type_id set (usually required in the Form).
    But, since it does not make sense to set suggested_next_type_ids in this case :
      - chaining_type will stay hidden in the Form
      - triggered_next_type_id will always be shown and is not marked as required in the Form
      - if triggered_next_type_id is not set, chaining_type will be "suggest"

Task ID : 2410217
PR : https://github.com/odoo/odoo/pull/63370
UPGRADE : https://github.com/odoo/upgrade/pull/2167
2021-03-03 12:12:52 +00:00
Michael Mattiello (mcm)andged-odoo 7086488064 [REF] web, *: remove patchMixin + imp utils.patch
* hr, hr_holidays, im_livechat, mail, snailmail, website,
  website_livechat

This commit removes `patchMixin` and improve `utils.patch`.
`utils.patch` now supports native classes and has a new parameter
used to patch class members.

`utils.patch` is now used everywhere `patchMixin` was and it must
be used to patch classes.

closes odoo/odoo#65967

Related: odoo/enterprise#16278
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
Co-authored-by: ged-odoo <ged@odoo.com>
2021-02-26 10:39:21 +00:00
Sébastien Theys 3d219cf548 [FIX] mail: make Inbox counters more reliable in mark as read flows
- Send the new Inbox counter when marking as read, to guarantee the JS has the
  correct value (instead of having to guess it which was impossible when an
  arbitrary domain was given to the method).

  NOTE: Manual increment is kept on receiving a new Inbox message because that
  one was reliable and it would have been more tricky to compute the new counter
  for each target partner (mark as read is one user doing an action for himself,
  whereas new message is from another user to potentially many different users).
  Generic counter for threads is also not sent on every change for similar
  reasons.

- Refresh Inbox automatically when some messages are marked as read and there
  are more message on the server than currently loaded.

- Remove confusing (and impossible to maintain) counter on non-origin threads
  (in particular channel followers). This behavior in JS was not consistent with
  the server which always counted only origin thread (model/res_id).

task-2446302

closes odoo/odoo#65842

X-original-commit: f9bc1f98ed8f76846697cde68a760217b3af2aaf
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2021-02-09 17:45:00 +00:00
Thibault Delavallée 57fe16ef61 [IMP] mail: make some tools methods private
PURPOSE

Reorganize and lint mail.channel code. Purpose is to ease future modifications
linked to groups and channels in mail / Discuss.

SPECIFICATIONS

Some tools methods do not necessarily require to be public.

LINKS

Prepares Task ID-2070632 (Discuss channel task)
Prepares Task ID-2419762 (SM channel task)
COM PR odoo/odoo#64862
2021-01-21 14:01:57 +00:00
qsm-odoo e5572c317a [REV] web_editor, *: remove Jabberwock
*: barcodes, mail, mass_mailing, note, test_website, web, web_tour,
   website, website_blog, website_event, website_form, website_forum,
   website_mail_channel, website_mass_mailing, website_profile,
   website_sale, website_twitter, doc

New solutions are being investigated in master. For the moment, it seems
better to remove Jabberwock to unlock difficult forward-port between
14.0 and 14.1/master, until we decide what to do once and for all in
a later master. We may un-revert this later but that would be way easier
than reverting Jabberwock in a few months.

This was done as safely as possible by removing any commit related to
Jabberwock, then resolving conflicts, then reforcing commits from 14.0
that were hugely adapted for 14.1/master, then forcing the whole diff
over a rebased 14.1/master. The only possible miss (other than me making
a mistake) would be commits that were not forward-ported to 14.1 thanks
to Jabberwock handling the issue on its own (I know we had such commits
in website, which I manually included in this revert, see below).

For reference:

Commits which were reforced to their 14.0 version:
- https://github.com/odoo/odoo/commit/1a916fc2362c0b006460d94a219366ade1cce058
- https://github.com/odoo/odoo/commit/fd9e58a675bb7ec1bf97cb77b21b3c65369d51fe
- https://github.com/odoo/odoo/commit/bdfddace29b16404c06a7ebfc0cc242463a0e768
- https://github.com/odoo/odoo/commit/42b3ad10e0b32b7fc72f801e2c67d6baf938c566
- https://github.com/odoo/odoo/commit/710784da1f02d45cbe898da426ba7e2ac63dc711
- https://github.com/odoo/odoo/commit/597585c9b8b1350bcfd84e8433ea6c82060bcc3d
- https://github.com/odoo/odoo/commit/333a9124608ff655bd9ad5e63044a5cb7ef9c636

Commits that were not forward-ported to 14.1/master and now are:
- https://github.com/odoo/odoo/commit/55ff2d971b672dec5f103215be39101c88856b6c
- https://github.com/odoo/odoo/commit/ebbb3de1e5f363689a5ba1647bb4c26416e42d5b

+ Adapt this forward-port: https://github.com/odoo/odoo/pull/60976 (as
  it was simplified for non-stable master version relying to the
  Jabberwock implementation and now needed to be adapted to the
  summernote implementation).
  See `!$el.data('oe-expression') && $el.data('oe-xpath')`

+ Revert https://github.com/odoo/odoo/pull/60477 and reforce original
  14.0 fix https://github.com/odoo/odoo/commit/746bf53b4aecfc601f0581a948d7cb7153812c82

Note: this also means that any good refactoring that was done by the
Jabberwock-related commits is lost for now. Once the revert reaches
master, I'll try and restore what we want from those commits. Here
are their references (but obviously they have the opposite conflicts
than those resolved during this revert):

e766842a92b6 [REM] web_editor,website: empty summernote files
08c94c986e09 [REF] web_editor,web: adapt to new jabberwock editor
1546c1b74713 [REF] mass_mailing: adapt to new jabberwock editor
fd0b963c6028 [REF] website: adapt to new jabberwock editor
0113d05c6c94 [ADD] web_editor: add new Jabberwock editor lib
d0c88a396493 [FIX] web_editor: don't change background color out of the website editor
d52d3d67d4e1 [FIX] web_editor : better icon in text style dropdown
61cb2f0d21da [FIX] web_editor: should not ask if want to leave the page twice
c42012b863b5 [FIX] web_editor: trigger a resize when use the mobile preview
d934d05d6e39 [FIX] web_editor: need to build the snippet before commit it into vDom
495bea924745 [FIX] web_editor: remove box shadow on the #wrap container
bffb5612e689 [ADD] field_html: add resizer in most field_html
f3c94e40cccf [IMP] web_editor: update Jabberwock library to commit 41e4063
cc87dea3ef32 [FIX] web_editor: update header change position to work with JW
5d9b25f66704 [FIX] web_editor: do not insert chars around step icon on click
70d3f0e4630c [IMP] web_editor: update Jabberwock library to commit 0bd94881
a57f13891f82 [FIX] web_editor: open media modal in appropriate tab on dblclick media
5b7537397e08 [IMP] web_editor: update Jabberwock library to commit a7ba7c34
a8d7ec235eeb [FIX] web_editor: adapt iframe Qunit test to new editor
5f794eac7209 [FIX] mass_mailing: hide all panels on show themes
551d45641d19 [IMP] website: remove unused reference
10580e1c102f [IMP] wesbite: add comment in tour
c17049f6b764 [FIX] web_editor: Fix description toggle in pricelist snippet
18a428e854b1 [IMP] web_editor: update Jabberwock library to commit 43a10003
58a161c645a5 [REF] web_editor, website: use editor helper setClass
62dd0bd3bc66 [FIX] web_editor: properly deactivate snippets and reactivate the last
99eebcaa34cb [FIX] web_editor: disable snippet in preview mode on mouse leave options
a84216932958 [FIX] web_editor: fix the image gallery snippet
f8dd4ea3e7d5 [FIX] web_editor: fix shadow selector for Safari
e50a4f3a16de [IMP] web_editor: update Jabberwock library to commit de13ed7e
4a2718f7a5ba [FIX] web_editor: ensure dom is properly cleaned at end of save test
03684c004a4e [FIX] website: ensure reset of bg-image on add bg-video
d63397159708 [FIX] web_editor: fix image remove from images wall
82fa5142f1a5 [IMP] note: restyle note without sheet or resizer
8b9f1ce603d5 [FIX] web_editor: properly mock createWysiwygIntance (sic) in tests
fc2183b66305 [FIX] web_editor: image overlay did not update with changes
cd0d2f5791cd [FIX] web_editor: add color preview to color picker
28a168172454 [FIX] web_editor: restore removal of spinner
67c90dd3b946 [FIX] website_forum: properly initialize editor
920dfe2a430a [FIX] website_forum: better css in the JW toolbar
43f33fd651af [IMP] web_editor: update Jabberwock library to commit 6853b60
71246c92f8de [FIX] Web_editor: table options button should be inside the toolbar
12b9e5916692 [FIX] web_editor: properly update the image options on replace image
e889cf8583da [FIX] website, website_sale: properly save filter id of dynamic snippets
e0fd11e36e45 [IMP] web_editor: update Jabberwock library to commit 4b2c903b
8f2b7ba35614 [FIX] web_editor: properly stop snippet option changed event propagation
a30c2c4105c7 [FIX] website: fix megamenu snippet editor behavior
312091cf822b [FIX] web_editor: fix overlay that is not reappearing
9f1d03dda613 [FIX] web_editor: table picker not fully displayed
814ddada6124 [IMP] web_editor: remove message before leaving page if editor is destro
4f38e26af7da [FIX] web: allow saving copyright footer
01e947b6123b [FIX] web_editor: only save translations that changed
103676072c50 [FIX] web_editor: prevent traceback on open crop dialog
5844ff66d4a0 [FIX] web_editor: apply image crop in jw on save dialog
1b435652e4a0 [FIX] website_forum: ensure media modal opens on click button
4f4a6ca0b8ac [FIX] web_editor: ensure valid default html value
51e22026ac7b [IMP] web_editor: update Jabberwock library to commit ab1184f8
2413fa19be0e [FIX] web_editor: Qunit test properly wait for editor stop
aa89e1ea3e97 [FIX] web_editor: properly save view blocks with an id
e2e90b53992e [FIX] web_editor: ensure language selector is non editable
0efd72089d5c [IMP] web_editor: clean useless lines
f54dfc7631f9 [IMP] web_editor: remove useless comment
3995ab1b84f2 [IMP] web_editor: update Jabberwock library to commit b8d73691
0834b1e5740a [IMP] web_editor: withDomMutations
f1459fb7b45c [FIX] web_editor: fix non-deterministic error in QUnit wysiwyg tests
6e8acc6c8cc7 [IMP] web_editor: update Jabberwock library to commit 3bbb175c
18a0c95d51cb [FIX] website, web_editor: #wrapwrap in body
4686a92e742c [FIX] website_form: allow edition of success message
78cc4da075cc [FIX] web_editor: allow edition of branded nodes only
bcffa7353448 [FIX] web: dialog should not use field value footer items
67ff56e14746 [FIX] web_editor,website_mass_mailing: display the popup preview
3cb9bea50c20 [IMP] web_editor: update Jabberwock library to commit a20492ea
518f03e6f1c9 [FIX] web_editor: use withIntangibles to find ZoneNode
d0ad6a568f49 [FIX] website: move sidebar out of theme
d690f5da13ea [FIX] website: properly save popup id
43b3433df3e6 [FIX] web_editor: fix non-deterministic error in QUnit wysiwyg tests
4ee8f4dedc30 [FIX] web_editor: prevent deadlock when removing child snippet of popup
850be198ef6d [FIX] web_editor: prevent traceback on reposition background image
4c3eaba41f5d [FIX] mass_mailing: adapt tour to the new editor design.
496d3ea272ed [FIX] web_editor: properly position sidebar scrollbar
5be4de703074 [FIX] web_editor: Show the toolbar when select the text in forum edition

closes odoo/odoo#63768

Related: odoo/enterprise#15458
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-12-24 13:36:49 +00:00
Julien Giannone 0286a46c96 [IMP] mail: Rename temporary to uploading in attachments related content
This commit renames "temporary" into "uploading" in attachments content

task-2337268

closes odoo/odoo#62526

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2020-12-15 12:48:21 +00:00
Sébastien Theys fe93fc28eb [FIX] mail, im_livechat: properly handle multiple public partners
task-2391334

closes odoo/odoo#63002

X-original-commit: 9fbea9f8ee193e672c855c73ad29de187f27cef1
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2020-12-08 11:28:38 +00:00
Xavier Dubuc bdff0f6d28 [FIX] mail: fix partner seen infos wrongly set as readonly
task-2391981

closes odoo/odoo#62239

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2020-12-04 09:06:49 +00:00
Julien Giannone 225ae4d53e [FIX] mail: Sidebar channel find shows all channels
When searching for a channel in Discuss, the search results include
all matching channels even those user is already member of

task-2347837

closes odoo/odoo#62161

X-original-commit: 884bebb0f549dc4385cec9542f74e0bba64ccb08
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2020-11-23 11:39:50 +00:00
Sébastien Theys 91bbdf41f4 [FIX] mail: fix race conditions, especially with scroll
The `_update` of some components must take place before the `_update`
of other (usually sibling) components that might directly influence their
layout. This is in particular the case for `_update` that are relying on height.

Prevent force save of scroll position if there are pending hints to adjust it,
and prevent pending hints from overriding new scroll value.

Prevent flicker with message date.

This should fix all known issues related to incorrectly saving or restoring
scroll position.

task-2344226
task-2358066
task-2369332
task-2372339
task-2373741

closes odoo/odoo#61791

X-original-commit: 2002c6a599a685f4a18fc670a9f7992c8d595c0f
Related: odoo/enterprise#14759
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2020-11-16 15:40:10 +00:00
Xavier Dubuc 3dd9c3b7f9 [FIX] mail: handle transient messages with (un)seen notions
task-2343887

closes odoo/odoo#61180

X-original-commit: 03481fd3df9bc53a17ba884ad4029ae46d7e54bf
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2020-11-02 14:56:57 +00:00
Martin Trigaux c59c10f1bc [FIX] *: correct typos and bad English
Courtesy of translators
Reexport .pot of modified modules

closes odoo/odoo#61010

X-original-commit: 62a18bdb372e234107fd2099a2df5f9e3a442c96
Related: odoo/enterprise#14489
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2020-10-29 19:23:41 +00:00
Xavier Dubuc 59ecc564e0 [FIX] mail: do not consider message with subtype as empty
task-2362022

closes odoo/odoo#60890

X-original-commit: 65ffb692164d5370411059dca63223c08c8dc81f
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2020-10-28 11:38:16 +00:00
Julien Giannone 461ae4fc5e [FIX] mail: filter commands used in composer based on channel type
closes odoo/odoo#60644

Task-id: 2343850
X-original-commit: caaf436bdf1f72634bf8a83672c6f683e0013713
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2020-10-23 15:04:52 +00:00
Didier (did) 66dca07144 [FIX] mail: add test to the suggested recipient feature
task-2343795

closes odoo/odoo#60625

X-original-commit: a76a576ad25c928e006812cf20423a592de03b30
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2020-10-23 13:19:20 +00:00
Sébastien Theys 562fdd67f2 [FIX] mail: do not return members of channels in channel_info
This PR has 3 parts:

The members fix itself, which is necessary for performance reasons especially
at init messaging, as per described in the task.

Adding the partner name in the typing payload, because due to not knowing all
members anymore, it is necessary to properly display who is typing.

Restrict restoring scroll position only if the corresponding scroll height is
available, to make the scroll feature and particularly the corresponding tests
more robust.

task-2360020

closes odoo/odoo#60616

X-original-commit: 91ce61ba568d83190e7ed2c168fd56101474683b
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2020-10-23 12:27:57 +00:00
95d0ca4b2c [REF] web_editor,web: adapt to new jabberwock editor
Co-authored-by: Nicolas Bayet <nby@odoo.com>
Co-authored-by: Sébastien Geelen <sge@odoo.com>
Co-authored-by: Antoine Guenet <age@odoo.com>
Co-authored-by: Christophe Matthieu <chm@odoo.com>
Co-authored-by: David Monjoie <dmo@odoo.com>
2020-10-14 10:29:09 +00:00
Xavier Dubuc ec3f5cdaf8 [FIX] mail: ask for confirmation before attachment deletion
also hide all messages with empty body and no attachments

task-2282322

closes odoo/odoo#59675

X-original-commit: 60ae42dcda777cd66e4e421dbc02f9ef12a430ef
Related: odoo/enterprise#13974
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2020-10-09 17:28:17 +00:00
Sébastien Theys b503c7f9f0 [FIX] mail: avoid useless (un)link when using replace
Side effect of this change: dependencies are not longer triggered when replace
is not actually doing anything.

task-2270780

closes odoo/odoo#59515

X-original-commit: 75a44675873d65fdf17f2205772b05a0f59bb42c
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2020-10-08 13:21:06 +00:00
Xavier Dubuc 265b1f92d3 [IMP] mail: test new message separator in some edge cases
task-2348620

closes odoo/odoo#59286

X-original-commit: 53ed641a60e6d572a12d96406b64af5b55fe177e
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2020-10-06 13:33:11 +00:00
Xavier Dubuc 607ac6e912 [FIX] mail: do not show new messages separator for own messages
Also fix compute of local counter in some specific situations.

task-2341740

closes odoo/odoo#58866

X-original-commit: 0df66708defd0fcb288979b1431d8180831e43d3
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2020-09-29 18:36:38 +00:00
Sébastien Theys 7574797589 [FIX] mail: prevent unnecessary fold state RPC
When the pending value is the same as the current server value, the pending
value should be ignored and no RPC should be done.

In particular this prevents a non-main tab from calling the RPC when receiving
a bus notification that would lead to closing a chat window, which in turn used
to call the close RPC again before this commit.
This led to inconsistencies especially on the main tab, if the chat window was
requested to be open again after the initial close, but before the "secondary"
close, it would end up closing instead of opening.

The current commit reduces the issue and prevents as many unnecessary RPC as
there are tabs open, which is a good improvement.

But it does not negate it completely. Indeed, when quickly closing then opening
the same chat window, it might still happen for network reasons that the RPC or
the corresponding bus notifications are received in the wrong order. This is
less frequent both functionally (to click so fast) and technically (to have the
network that slow) at the same time, so it is considering acceptable / out of
scope.

The opportunity is taken to clean up the code by removing unnecessary fields and
making use of compute and flux specific RPC instead of `_updateAfter`.

task-2273658
task-2329521

closes odoo/odoo#58369

X-original-commit: cbb1d855c7af5f78819db3cd476dbe0f985bc214
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2020-09-23 17:30:41 +00:00
Julien Giannone 9fc3fe1dba [IMP] mail: reintroduce channel mentions, canned responses, commands
task-2280308

closes odoo/odoo#58167

X-original-commit: b63d0d2ee5f3bff24a5e1e1cd962d59bebef082d
Related: odoo/enterprise#13393
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2020-09-21 21:12:22 +00:00
Didier (did) d68bdf8720 [FIX] mail: restore the "to followers" feature
Before this commit, the "to followers" message inside the chatter composer was
missing.
Fix also some padding issue.

This also restore the form dialog when you try to send a message to a suggested
recipient that doesn't have a partner (someone in CC email for eg).
But now, suggested recipient without partner are unchecked by default and the
form open when the user try to check them. If the user discard the form dialog,
the suggested recipient isn't checked.
This is better since only a partner will receive a notification.

task-2280157

closes odoo/odoo#58162

X-original-commit: 67d151cc36871d87b92676357a31a70de5a92fce
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2020-09-21 17:12:43 +00:00
Xavier Dubuc 356a5448fe [FIX] mail: fix notification partners display in popover
Handle notification creation in convertData correctly.

task-2324260

closes odoo/odoo#58013

X-original-commit: ca457e990c87cd0405a2b7416a6c8064a9a83e21
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2020-09-18 09:42:09 +00:00
Xavier Dubuc b2d9170aef [FIX] mail: fix "New messages" separator and channel_seen behaviour
- channel_seen is now called even for own message and only when needed
- channel_seen is now called with a message_id which transfer the
  decision of what is seen to the client which makes more sense

task-2282235
task-2282248

closes odoo/odoo#57956

X-original-commit: 04edfa50ccea305050d017c4a1996e561bc7bd57
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2020-09-17 13:45:35 +00:00
Xavier Dubuc 8d96bfd080 [FIX] mail, sms, snailmail: prevent message_fetch for hidden threads
Automatically load messages from a thread cache only if the thread cache is used
in at least one thread view.

Ensure thread viewer don't keep thread view records alive when they are not
displayed.

This change is particularly important for performance, to avoid spamming RPC at
init if many threads are opened in chat windows.

task-2310623

closes odoo/odoo#57121

X-original-commit: 8d3413ff647de8d98c6858062dd07dde4160af95
Related: odoo/enterprise#12979
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2020-09-04 17:01:43 +00:00
Sébastien Theys 590a088750 [FIX] mail, *: fix opens and redirects, adapt messaging menu close
task-2244279
task-2262862
task-2274993
task-2277537
task-2282238

closes odoo/odoo#56755

X-original-commit: 17611f4adc5e950b0a75a2a6615b1da3c956387f
Related: odoo/enterprise#12769
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2020-08-28 17:34:13 +00:00
Sébastien Theys efb66e8e7f [FIX] mail, im_livechat: make livechat work properly
- fix traceback on receiving first livechat message due to bad computation of
  correspondent
- fix missing [0] in return of country name_get in channel_info
- fix visitor/correspondent computation to work when chatting with oneself
- reintroduce livechat ordered by last message in discuss sidebar
- improve mock server to make these fixes possible to test
- introduce corresponding tests

PR: #56243
task-2323670

closes odoo/odoo#56423

X-original-commit: f623bfd2c8819604c709bc723153c071dca6e3cc
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2020-08-24 13:47:01 +00:00
Sébastien Theys 7bec33f578 [FIX] mail: ignore broadcast notifications targeting another user
This is typically not the case in production code, but it doesn't hurt to be
safe. The main reason for the change however is that it causes issues in tests
due to the easiest way to simulate notifications being to send them directly on
the bus which is "listened to" no matter the target user.

PR: #56243
Part of task-2323670

X-original-commit: 62e1e7fe39a7bed6ce70466a0aec645c7a0f299d
2020-08-24 13:47:00 +00:00
Priyanka Kakadiya 2b06be6860 [IMP] mail: improve followers refreshed on thread
PURPOSE

Currently it does two RPCs to refresh followers on thread:
1) To get follower ids
2) To get followers detail

SPECIFICATION

While refreshing followers on the thread, perform only one RPC call.

LINKS

Task-2243180
PR https://github.com/odoo/odoo/pull/54437

closes odoo/odoo#55989

X-original-commit: 1fd445fb55810b97ed7a6dfe694e471891c6a3bc
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2020-08-17 11:56:46 +00:00
Sébastien Theys c2918c139b [IMP] web, *: improve mock server and replace most mail mockRPC
Improve mock server:

- add support for mocked `fetch`
- add support for `active_test`
- add support for x2m `in` in domains
- add support for default values computed from a function
- implement a more natural "next id" compute
- allow initial data without ids
- ensure write and x2m commands integrity
- improve bad data/bad commands error messages
- always warn for failing RPC, not only in debug mode
- fix all existing tests that had inconsistency data

Other changes done in mail (or dependents) that are not just related to tests:

- remove `direct_partner` from formatter result
  ->`correspondent` can be computed from other keys, especially `members`

- fix `livechat_visitor` convertData
  -> only process if there is value

- add `current_partner` and `current_user_id` as `init_messaging` result
  -> easier to mock than session

- remove usage of `need_moderation`
  -> that was just a search indirection to `moderation_status`

- adapt `partner_id` -> `res_partner_id` key in `_notification_format`
  -> to be consistent with field name

- add name in result of `mail_partner_format`
  -> sometimes display_name is not the same

- remove usage of `is_moderator`
  -> that was just an indirection to `moderation_channel_ids`

Enterprise counterpart: https://github.com/odoo/enterprise/pull/11523
task-2287171

closes odoo/odoo#55854

X-original-commit: 7ba3fecb3377a720d1eb70e7515a0c45da73836d
Related: odoo/enterprise#12391
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2020-08-13 16:26:35 +00:00
Xavier Dubuc a17725e998 [FIX] mail: fix full composer opening with attachments
task-2307201

closes odoo/odoo#55678

X-original-commit: 9c47bb0b0034a3419a0c6e3267d90cb520a59535
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2020-08-13 10:23:25 +00:00
Sébastien Theys 78bef3e08c [FIX] mail: improve performance of JS write, especially for x2m
- store `x2many` values as `Set`. This is conceptually more correct because
  duplicates were already not allowed, and using a `Set` allows for much faster
  operations such as checking the presence of a record in the relation, which is
  done at every write, for every linked record.

- `stringify` in `write` was slow and unnecessary because we can always assume
  that new non-primitive should be provided to `write`

- remove field values from store, in favor of just storing a counter, which is
  enough to trigger renders. This allows to get rid of one Proxy level around
  data, which was slower, but which also prevented from using `Set`.

- write in store exactly once per update cycle, to trigger one `useStore` call
  on each component. Records keep `__state` but as a local counter, to let
  `useStore` know which records have been updated (easier to compare a counter
  than comparing each and every field value).

Results
=======

The worse case test (using a lot of x2m) that was used to benchmark this PR
`form_renderer_tests.js` of `mail_enterprise` went from taking around 4s before
this commit, to around 2.5s after this commit.
And the worse `_setRelationLinkMany2Many` previously took around 250ms, and it
now takes around 50ms.

The whole `mail` QUnit suite took around 55s before, now around 42s.

Part of task-2308312

closes odoo/odoo#55248

X-original-commit: 4db0a10d85534ef896f6bcbf13bca4983a6e2003
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2020-07-31 09:43:01 +00:00
Xavier Dubuc c767df5e97 [FIX] mail: set full composer subject and recipients
task-2291887
task-2291893
task-2291898

closes odoo/odoo#54531

X-original-commit: 26170ad9ab09d75de2e0af98fb7daedc2ed57e50
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2020-07-15 16:18:53 +00:00
Sébastien Theys dc011d1246 [IMP] mail: MockServer: add get_mention_suggestions on res.partner
Pr: #53449
X-original-commit: 4f21a77703985d085037dc3d0e472970573810ec
2020-06-26 11:21:35 +00:00
Lucas Perais (lpe) 257371bab5 [FIX] mail: discuss: unpin channel fixes
FIX: use the correct API of mail.channel.py to unfollow a channel
i.e.: `execute_command_leave`

FIX: unpinning a channel has immediate effect on the interface
chatWindows are closed, and the inbox is displayed

FIX: unpinning a channel destroys corresponding chatWindows across tabs
It also unpins the channel in other tabs

FIX: python sends is_pinned as part of the channel_info
both at init messaging and in the main bus notification
That way, we can keep track of the synchronization of the pin status
between JS and python

task-2275000
task-2267941

closes odoo/odoo#53703

X-original-commit: d4fcc64acb2fc0c6fd9df505380f665abd8b39c4
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2020-06-26 00:54:54 +00:00
Sébastien Theys 652d835f77 [FIX] mail: restore close of other menus on click of messaging menu
task-2278830

closes odoo/odoo#53566

X-original-commit: 0407151b34da16ca54066bb15e578dc1db85f365
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2020-06-24 10:22:58 +00:00
3fea5b2136 [REF] mail, *: refactor messaging with OWL
This commit is a significant rewriting of client-side discuss, chatter,
chat window, and messaging menu using OWL. The behavior should be broadly
the same, with some slight functional changes here and there.

From a technical standpoint, the code of messaging is mainly organized in 2
main groups of modules:

- models, which are logical entities that depict the client-side state of
  messaging as a whole.
- components, which are in charge of displaying information from models.

This refactoring also introduces new JS guidelines regarding folder structure
(/static) and naming rules for JS modules.

Community PR: https://github.com/odoo/odoo/pull/39023
Enterprise PR: https://github.com/odoo/enterprise/pull/6249

Task-1914207

This PR is a collaborative work by Alexandre, Julien, Sébastien and Xavier,
with the precious help of Lucas to speed it up towards the end.

closes odoo/odoo#39023

Related: odoo/enterprise#6249
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Co-authored-by: Alexandre Kühn <aku@odoo.com>
Co-authored-by: Julien Giannone <jgi@odoo.com>
Co-authored-by: Lucas Perais <lpe@odoo.com>
Co-authored-by: Sébastien Theys <seb@odoo.com>
Co-authored-by: Xavier Dubuc <xdu@odoo.com>
2020-06-15 18:12:21 +00:00
Aaron Bohy b4ba0fc340 [FIX] *: adapt tests to env rework
This commit adapts tests following recent changes on the helpers.
The main change is that addMockEnvironment (and all functions using
it) are now async, as they need to wait for services to be started.
2020-06-12 09:47:48 +00:00
Julien Mougenot c4786fccfd [IMP] *: update notifications to optional title
closes odoo/odoo#52826

Related: odoo/enterprise#11084
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-06-12 09:01:50 +00:00