From c5dc0b2f39aa98c48953e1d1510495687f5e4f39 Mon Sep 17 00:00:00 2001 From: "Julien (juc) Castiaux" Date: Tue, 23 Oct 2018 15:08:36 +0000 Subject: [FIX] mail: spam the send button create multiple messages Spamming the "send" button on the chatter send multiple times the same message. This PR simply disable the send button to fordib the spam. opw-1895511 closes #27233 closes odoo/odoo#28078 --- addons/mail/static/src/js/composer.js | 3 +++ 1 file changed, 3 insertions(+) (limited to 'addons/mail/static/src') diff --git a/addons/mail/static/src/js/composer.js b/addons/mail/static/src/js/composer.js index a235eb04d46..b8044445fc1 100644 --- a/addons/mail/static/src/js/composer.js +++ b/addons/mail/static/src/js/composer.js @@ -479,10 +479,13 @@ var BasicComposer = Widget.extend(chat_mixin, { }, send_message: function () { + var $button = this.$('.o_composer_button_send'); + if (this.is_empty() || !this.do_check_attachment_upload()) { return; } + $button.prop('disabled', true); clearTimeout(this.canned_timeout); var self = this; this.preprocess_message().then(function (message) { -- cgit v1.2.3 From ac08e2ba53297b303c00be25ba46af3e727db625 Mon Sep 17 00:00:00 2001 From: Olivier Colson Date: Fri, 26 Oct 2018 11:31:58 +0200 Subject: [FIX] mail: display both tracking values and body of the messages in mail thread Before that, the body of the message was never displayed if the message had tracking values. This was annoying for account_asset module, were we prompt the user for some justification when she modifies the depreciation data of an asset, and then call message_post with this text as body, and tracking values reflecting the change that was made. --- addons/mail/static/src/xml/thread.xml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'addons/mail/static/src') diff --git a/addons/mail/static/src/xml/thread.xml b/addons/mail/static/src/xml/thread.xml index b9579be0790..5ec1d754100 100644 --- a/addons/mail/static/src/xml/thread.xml +++ b/addons/mail/static/src/xml/thread.xml @@ -121,6 +121,7 @@ t-att-data-message-id="message.id" title="Mark as Read"/>

+

@@ -128,9 +129,6 @@

Subject:

- - - -- cgit v1.2.3 From 91dfb15c3c17d99c175fe89cbd75eb0999069013 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20K=C3=BChn?= Date: Wed, 24 Oct 2018 13:19:46 +0000 Subject: [FIX] mail: mark as read only when accessing to chatter Backport of 17bb0ca443f54bc231b03794e776bbc6992ffdfa Before this commit, the user could not receive any notification from the chatter of a document when having Notification Management set to "Handle with Odoo". This problem occurs when the user opens (or has opened) the document. Any messages received from the document are automatically marked as read, so it removes the notification right after receiving it. In order to no longer have this issue, the user had to reload all pages that have opened this document. This commit slightly changes the behaviour of the chatter, so that it automatically marks it as read only when accessing the document, but not when the document is open (or has been opened). Consequently, if the user has opened the document and then receives a notification from this document, it won't automatically mark it as read. Task-ID 1895359 opw-1890556 closes odoo/odoo#28113 --- addons/mail/static/src/js/chat_manager.js | 4 +++- addons/mail/static/src/js/thread_field.js | 6 ++++++ 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'addons/mail/static/src') diff --git a/addons/mail/static/src/js/chat_manager.js b/addons/mail/static/src/js/chat_manager.js index d83054e0f0a..727432fb55a 100644 --- a/addons/mail/static/src/js/chat_manager.js +++ b/addons/mail/static/src/js/chat_manager.js @@ -863,7 +863,9 @@ var ChatManager = Class.extend(Mixins.EventDispatcherMixin, ServicesMixin, { if ('ids' in options) { // get messages from their ids (chatter is the main use case) return this._fetchDocumentMessages(options.ids, options).then(function(result) { - chat_manager.mark_as_read(options.ids); + if (options.shouldMarkAsRead) { // DO NOT FORWARD-PORT + chat_manager.mark_as_read(options.ids); // DO NOT FORWARD-PORT + } // DO NOT FORWARD-PORT return result; }); } diff --git a/addons/mail/static/src/js/thread_field.js b/addons/mail/static/src/js/thread_field.js index 75e379e6ea1..64b3440e364 100644 --- a/addons/mail/static/src/js/thread_field.js +++ b/addons/mail/static/src/js/thread_field.js @@ -19,6 +19,7 @@ var ThreadField = AbstractField.extend(chat_mixin, { init: function () { this._super.apply(this, arguments); this.msgIDs = this.value.res_ids; + this._markAsReadOnRender = true; // DO NOT FORWARD-PORT }, willStart: function () { return this.alive(this._chatReady()); @@ -67,6 +68,7 @@ var ThreadField = AbstractField.extend(chat_mixin, { this.msgIDs = this.value.res_ids; // the mail widgets being persistent, one need to update the res_id on reset this.res_id = record.res_id; + this._markAsReadOnRender = true; // DO NOT FORWARD-PORT }, // public @@ -89,6 +91,10 @@ var ThreadField = AbstractField.extend(chat_mixin, { var self = this; options = options || {}; options.ids = ids; + if (this._markAsReadOnRender) { // DO NOT FORWARD-PORT + options.shouldMarkAsRead = true; // DO NOT FORWARD-PORT + this._markAsReadOnRender = false; // DO NOT FORWARD-PORT + } var fetch_def = this.dp.add(this._getMessages(options)); return fetch_def.then(function (raw_messages) { self.thread.render(raw_messages, {display_load_more: raw_messages.length < ids.length}); -- cgit v1.2.3