summaryrefslogtreecommitdiff
path: root/addons/mail/static/src/models/thread/thread.js
diff options
context:
space:
mode:
authorSébastien Theys <seb@odoo.com>2020-08-24 10:37:47 +0000
committerSébastien Theys <seb@odoo.com>2020-08-24 13:21:45 +0000
commit72b9335334c076d8deaa36e404feaa3f4d30c351 (patch)
treeaea8c816b33d89b409fedbc75bcca3d2d6597717 /addons/mail/static/src/models/thread/thread.js
parent0834d241624330ab3fd3925366a3217fe8145dfc (diff)
[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#56414 X-original-commit: f623bfd2c8819604c709bc723153c071dca6e3cc Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Diffstat (limited to 'addons/mail/static/src/models/thread/thread.js')
-rw-r--r--addons/mail/static/src/models/thread/thread.js12
1 files changed, 12 insertions, 0 deletions
diff --git a/addons/mail/static/src/models/thread/thread.js b/addons/mail/static/src/models/thread/thread.js
index 74cae5d25ab..e3d48d54e35 100644
--- a/addons/mail/static/src/models/thread/thread.js
+++ b/addons/mail/static/src/models/thread/thread.js
@@ -779,8 +779,13 @@ function factory(dependencies) {
partner !== this.env.messaging.currentPartner
);
if (correspondents.length === 1) {
+ // 2 members chat
return [['link', correspondents[0]]];
}
+ if (this.members.length === 1) {
+ // chat with oneself
+ return [['link', this.members[0]]];
+ }
return [['unlink']];
}
@@ -1360,6 +1365,13 @@ function factory(dependencies) {
messages: many2many('mail.message', {
inverse: 'threads',
}),
+ /**
+ * All messages that are contained on this channel on the server.
+ * Equivalent to the inverse of python field `channel_ids`.
+ */
+ messagesAsServerChannel: many2many('mail.message', {
+ inverse: 'serverChannels',
+ }),
messageSeenIndicators: one2many('mail.message_seen_indicator', {
inverse: 'thread',
isCausal: true,