summaryrefslogtreecommitdiff
path: root/addons/mail/static/src/js/models/threads/document_thread.js
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2019-09-04 19:32:26 +0200
committerChristophe Simonis <chs@odoo.com>2019-09-04 19:32:26 +0200
commit7a548569c665ae162510e7dc2ea48b16a041262a (patch)
tree68782d726176c44c283e36006891090295758ef0 /addons/mail/static/src/js/models/threads/document_thread.js
parentae50f2cbbba0a57b47039fcc8a8485dc857fa851 (diff)
parent638eac9baea60ee9126043ee0088232a5dee3668 (diff)
[MERGE] forward port branch 12.0 up to 638eac9baea
Diffstat (limited to 'addons/mail/static/src/js/models/threads/document_thread.js')
-rw-r--r--addons/mail/static/src/js/models/threads/document_thread.js27
1 files changed, 24 insertions, 3 deletions
diff --git a/addons/mail/static/src/js/models/threads/document_thread.js b/addons/mail/static/src/js/models/threads/document_thread.js
index 0ef02e5f57a..cb860b70beb 100644
--- a/addons/mail/static/src/js/models/threads/document_thread.js
+++ b/addons/mail/static/src/js/models/threads/document_thread.js
@@ -62,9 +62,16 @@ var DocumentThread = Thread.extend({
* shared between tabs, and restored on F5.
*
* @override
+ * @param {Object} [options]
+ * @param {boolean} [options.skipCrossTabSync=false] if set, it should
+ * not notify other tabs from updating document thread state. This happens
+ * in case the `close` operation comes from local storage event.
*/
- close: function () {
+ close: function (options) {
this._super.apply(this, arguments);
+ if (options && options.skipCrossTabSync) {
+ return;
+ }
this.call('mail_service', 'updateDocumentThreadState', this._id, {
name: this.getName(),
windowState: 'closed',
@@ -75,9 +82,16 @@ var DocumentThread = Thread.extend({
* shared between tabs, and restored on F5.
*
* @override
+ * @param {Object} [options]
+ * @param {boolean} [options.skipCrossTabSync=false] if set, it should
+ * not notify other tabs from updating document thread state. This happens
+ * in case the `detach` operation comes from local storage event.
*/
- detach: function () {
+ detach: function (options) {
this._super.apply(this, arguments);
+ if (options && options.skipCrossTabSync) {
+ return;
+ }
var windowState = this._folded ? 'folded' : 'open';
this.call('mail_service', 'updateDocumentThreadState', this._id, {
name: this.getName(),
@@ -105,9 +119,16 @@ var DocumentThread = Thread.extend({
* shared between tabs, and restored on F5.
*
* @override
+ * @param {Object} [options]
+ * @param {boolean} [options.skipCrossTabSync=false] if set, it should
+ * not notify other tabs from updating document thread state. This happens
+ * in case the `detach` operation comes from local storage event.
*/
- fold: function () {
+ fold: function (folded, options) {
this._super.apply(this, arguments);
+ if (options && options.skipCrossTabSync) {
+ return;
+ }
var windowState = this._folded ? 'folded' : 'open';
this.call('mail_service', 'updateDocumentThreadState', this._id, {
name: this.getName(),