Commit Graph
17 Commits
Author SHA1 Message Date
nda 64c995384d [FIX] mail: use chatter on archived record
The webclient returns a message "server error" if you add an attachment or send
a message on an archived record chatter.

steps to reproduce:
- archive a record (ex: a partner)
- send a message on the chatter or add an attachment

before this commit:
- a popup error is raised "server error"

after this commit:
- the chatter is working properly on archived records

opw-3689169

closes odoo/odoo#149862

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2024-01-18 21:49:42 +00:00
Thibault Delavallée bc95b89d2d [FIX] mail: correctly escape / encode HTML when updating content
Fix various use case of HTML encoding / escaping in mail flows. Depending on
functional flow HTML entities could appear as they were not correctly
managed as valid HTML.

Notably when managing attachments in '_process_attachments_for_post' we
should return Markup-ized HTML to be sure it is considered as valid in
other post processing.

Task-3675159 (Mail: correctly escape HTML when updating content)
Task-3619348 (Mail: propagate markup flag when processing attachments)

closes odoo/odoo#148769

X-original-commit: f4bf63077d4129807e00e15b833e47623869491f
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2024-01-10 10:28:21 +00:00
Sébastien Theys 005b76462a [IMP] mail, im_livechat, *: simplify channel ACL
* = bus, crm_livechat, hr, mail_bot, test_discuss_full, test_mail,
    website_livechat

Now that livechat uses guest, we can write proper ACL for channel and
channel member to check if the current user/guest is a member.

This allows removing most sudo in code and to simplify search domains.
Remaining sudo in discuss folder have been reviewed and commented.

task-3394829

closes odoo/odoo#138330

Related: odoo/upgrade#5295
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2023-10-24 12:38:21 +00:00
Didier (did) 8fa2a6fe11 [IMP] mail: search a discuss thread
See https://github.com/odoo/enterprise/pull/43980

task-2359037

closes odoo/odoo#118794

Related: odoo/enterprise#43980
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2023-10-03 19:19:50 +00:00
tsm-odoo cdc35aed74 [IMP] mail: add decorator to extract guest
This PR adds the `add_guest_to_context` decorator in order to provide a generic
way to extract the guest from a request. It will be used to unified guest
extraction from cookie/param based on its provenance (external livechat/public
page).

This is better than the `pre_dispatch` method since it can be applied to
specific routes instead of adding this logic to every request.

part of task-3332628

closes odoo/odoo#130052

Signed-off-by: Matthieu Stockbauer (tsm) <tsm@odoo.com>
2023-08-09 13:20:53 +02:00
tsm-odoo f5442e970a [IMP] mail: add guest to context when available
This PR prepares the ground for the one introducing guests
for livechat visitors. Since our SameSite cookie policy
is Lax, the cookie won't be send on unsafe cross site
requests thus another mechanism will be introduced to
retrieve the guest.

This PR abstracts the way the guest is retrieved in order
to ease this transition as much as possible by overriding
the `ir_http._pre_dispatch` method in order to inject the
guest in the context if any.

part of task-3332628

closes odoo/odoo#129039

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2023-07-25 17:35:40 +02:00
Didier (did) 1e12962743 [FIX] mail: suggested recipients are checked by default in chatter
Before this PR, suggested recipients without partner where not
checked and needed to be manually created. This is prone to mistakes
when sending an email to the suggested recipient.

This PR checks all the suggested recipients by default and create
the missing partners when a message is posted, and when full composer
is open. That way, there's far less risk to not send the email to
suggested recipient, and instead the user should manually uncheck
to not send the email.

closes odoo/odoo#128647

X-original-commit: 258b2420676fb1a0d7e834ab79f6bf1ec0f73254
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-07-17 20:36:07 +02:00
Sébastien Theys d289d8a7d0 [FIX] mail: make file upload consistent between guest and portal
opw-3370926

closes odoo/odoo#128290

X-original-commit: 2e5f8a3c9e7cff8c61f66e56da7b0f9a59f9bf2e
Signed-off-by: Vranckx Florian (flvr) <flvr@odoo.com>
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2023-07-13 08:28:06 +02:00
Sébastien Theys 89e6beff36 [FIX] mail: allow message edit when livechat is installed
Livechat override of `_message_update_content` accesses `self` channel
but it was not called with the guest env, leading to access error.

Part-of: odoo/odoo#128290
2023-07-13 08:28:06 +02:00
tsm-odoo aa2133a869 [FIX] mail: bad serialization error catching on message post
The `/mail/message/post` route wrongly prevent serialization
errors by suppressing any `OperationalError` when writing
on a canned response. This is wrong since the `write` method
does not issue any SQL.

In order to properly prevent serialization errors, the request
is now done with the `SKIP LOCKED` clause.

This is better since the error does not occur, hence:
- No rollback needed
- No need to mute the sql logger
- No need to suppress any exception

closes odoo/odoo#127761

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2023-07-07 17:58:00 +02:00
Thanh Dodeur e8a883ff65 [FIX] mail: prevent crash when deleting a message
Since https://github.com/odoo/odoo/pull/126713, deleting a message
would crash as the `mail/message/update_content` route is called without
passing the `partner_ids` parameter.

This commit fixes the issue by making the parameter optional.

closes odoo/odoo#127284

X-original-commit: 34abd3dc1d159962a376b248134d0cd4977f3dcb
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2023-07-05 02:47:42 +02:00
Didier (did) a2cd11c55b [FIX] mail: enable mentions when editing a message.
Before this commit, when editing a message, it was not possible
to add new mentions.

This commit adds the support to add new mentions when editing the
message.

Note that mentions added from editing message won't notify them:
it's only at creation of message that mentioned users are notified.

task-3329714

closes odoo/odoo#126888

X-original-commit: 1fe935d273142064784b9ecff2fff1c34e91064f
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-06-30 13:08:26 +02:00
tsm-odoo 3ed674645d [IMP] im_livechat: add last used date to mail shortcodes
This PR make add a last used date to the canned responses
in order to know whether they are still usefull or not.

part of task-3332872

closes odoo/odoo#125909

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-06-27 16:26:51 +02:00
Denis Ledoux 58ea5e7b43 [IMP] http.py: do not inject context by default in JSON routes
Before this revision, when you pass `context` in the arguments
of a JSON routes, this one gets automatically injected
in the environment context.

This is not the case for regular HTTP routes.

It makes sense to propagate the context for the JSONRPC protocol,
JSON routes used by the backend, such as `call_kw`,
but it doesn't make sense to pass this context automatically
for any other kind of routes, such as front-end routes
or routes used by custom Javascript widgets.

This change brings a more unified behavior for routes
of types HTTP and JSON.
In addition, most developers were not aware of this "feautre",
that passing `context` in the arguments of a JSON route leaded
to the injection of this context in the environment context.
This is actually reflected by the diff size this changes required,
only a dozens of routes needed to be adapted, to manually
add the context in their route arguments and to inject it
in their environment context.

closes odoo/odoo#121726

X-original-commit: a7a5655631e6d5b05fd2ba3d0c80617aae6d9cfe
Related: odoo/enterprise#41229
Signed-off-by: Denis Ledoux (dle) <dle@odoo.com>
2023-05-22 11:43:04 +02:00
Sébastien Theys 09ac15e2dd [REF] mail: clean code for message update
As a bonus, add cross-tab update for current user in chatter.

Part of task-3265211

closes odoo/odoo#120018

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2023-04-28 12:26:43 +02:00
Sébastien Theys 3d1a21dc18 [REF] mail: move channel of message post controller to discuss
Part of task-3265211

closes odoo/odoo#120002

Signed-off-by: Louis Wicket (wil) <wil@odoo.com>
2023-04-27 18:25:33 +02:00
Sébastien Theys ad58e0fdd8 [REF] mail: move discuss.channel code to its own folder (controllers)
This commit focuses on removing all references to discuss.channel from
controllers of mail module.

In preparation of splitting discuss and mail modules.

Part of task-3265211

closes odoo/odoo#119523

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2023-04-27 06:10:02 +02:00