[FIX] mail: enable canned responses in all non-channel threads

This commit reverts partially https://github.com/odoo/odoo/pull/116388

Intent of commit above was to solve a UX issue when user wanted
to send a message containing an emoji at the end, by using an
emoticon.
For example, user expects to type `:)` then `Enter` to post a message
with happy smiley, but instead it adds the 1st canned response
matching search term `)`.
The solution of commit was to enable canned response only in livechat
and in helpdesk.

However, canned responses are more popular than we thought, and they
are even used in other apps like Project. The users of Project either
use canned responses a lot or never. So it's not a good option to
simply disable canned responses in this app.

This commit make canned responses available in all threads except
`discuss.channel` that are not livechat. In other words, canned
responses are specifically disabled in
- Public discuss channels
- Direct Messages chats
- Group chats

We think that conflicting features canned responses and emoticons
happen mostly in chats.
- Livechat needs canned response so there's still this clash, but
  canned response have a lot of value so it's fine for emoticon to
  be slightly harder to use.
- Public channels, group chats, and DM chats have no use for canned
  responses, therefore disabling canned response makes sense!

closes odoo/odoo#127522

X-original-commit: afdaa5e20e878d01d437d9a23a27cf4685c80448
Related: odoo/enterprise#43713
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
This commit is contained in:
Alexandre Kühn
2023-07-06 17:52:14 +02:00
parent 6c81d1fe60
commit d3f31ca584
@@ -8,7 +8,7 @@ import { patch } from "@web/core/utils/patch";
patch(SuggestionService.prototype, "im_livechat", {
getSupportedDelimiters(thread) {
return thread?.type === "livechat"
return thread?.model !== "discuss.channel" || thread.type === "livechat"
? [...this._super(...arguments), [":"]]
: this._super(...arguments);
},