summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexandre Kühn <aku@odoo.com>2018-03-07 15:02:05 +0100
committerAlexandre Kühn <aku@odoo.com>2018-03-07 15:11:01 +0100
commit3c821d4035d0c85f691653c47986d8f4c3dfc51d (patch)
tree4a0b14924ed64d3ef5403c79f55188792c06e53b
parent93ae1b1a041b6a36521263ff87ac980e6102551a (diff)
[FIX] mail: no traceback with attach/detach (discuss mobile)
Revision on https://github.com/odoo/odoo/commit/02ec09cb1c3e2d7bc7968f40c18f2208d7f3f498 From the refactoring above, some snake_case attributes have been converted into camelCase. That was the case in discuss.js, but we missed to propagate the changes in discuss_mobile.js. This commit fixes the traceback that came from the mistake above.
-rw-r--r--addons/mail/static/src/js/discuss_mobile.js4
-rw-r--r--addons/mail/static/tests/discuss_mobile_tests.js23
2 files changed, 25 insertions, 2 deletions
diff --git a/addons/mail/static/src/js/discuss_mobile.js b/addons/mail/static/src/js/discuss_mobile.js
index 52622b0ce32..b427ab4b98c 100644
--- a/addons/mail/static/src/js/discuss_mobile.js
+++ b/addons/mail/static/src/js/discuss_mobile.js
@@ -41,7 +41,7 @@ Discuss.include({
*/
on_attach_callback: function () {
if (this.channel && this._isInInboxTab()) {
- this.thread.scroll_to({offset: this.channels_scrolltop[this.channel.id]});
+ this.thread.scroll_to({offset: this.channelsScrolltop[this.channel.id]});
}
},
/**
@@ -49,7 +49,7 @@ Discuss.include({
*/
on_detach_callback: function () {
if (this._isInInboxTab()) {
- this.channels_scrolltop[this.channel.id] = this.thread.get_scrolltop();
+ this.channelsScrolltop[this.channel.id] = this.thread.get_scrolltop();
}
},
diff --git a/addons/mail/static/tests/discuss_mobile_tests.js b/addons/mail/static/tests/discuss_mobile_tests.js
index d17364b53ad..921436d4657 100644
--- a/addons/mail/static/tests/discuss_mobile_tests.js
+++ b/addons/mail/static/tests/discuss_mobile_tests.js
@@ -65,6 +65,29 @@ QUnit.test('mobile basic rendering', function (assert) {
});
});
+QUnit.test('on_{attach/detach}_callback', function (assert) {
+ assert.expect(2);
+ var done = assert.async();
+
+ createDiscuss({
+ id: 1,
+ context: {},
+ params: {},
+ data: this.data,
+ services: this.services,
+ }).then(function (discuss) {
+ try {
+ discuss.on_attach_callback();
+ assert.ok(true, 'should not crash on attach callback');
+ discuss.on_detach_callback();
+ assert.ok(true, 'should not crash on detach callback');
+ } finally {
+ discuss.destroy();
+ done();
+ }
+ });
+});
+
});
});