From be44efe852e96840ff6db139ea66952cbad74e1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20K=C3=BChn?= Date: Wed, 29 Aug 2018 13:56:53 +0200 Subject: [REF] mail: clean some JS code 1. Removed `getLocalMessages` method in mailbox, and replaced with an override on `getMessages`. (This method was used before the distinction was made between `getMessages` and `fetchMessages`) 2. Removed unused method `_warnUpdatedUnreadCounter` in abstract thread window. (Leftover from an early POC) 3. Set the default value `''` for the status of a thread. (The method `getStatus` should always return a string) 4. Enforce default value `false` for detached status of channel. (The method `isDetached` should always return a boolean) 5. Improve readability of some tests. (removed useless variables and/or redundant code) --- .../tests/thread_window/basic_thread_window_tests.js | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) (limited to 'addons/mail/static/tests/thread_window/basic_thread_window_tests.js') diff --git a/addons/mail/static/tests/thread_window/basic_thread_window_tests.js b/addons/mail/static/tests/thread_window/basic_thread_window_tests.js index ffda7d95700..347682e68df 100644 --- a/addons/mail/static/tests/thread_window/basic_thread_window_tests.js +++ b/addons/mail/static/tests/thread_window/basic_thread_window_tests.js @@ -196,23 +196,10 @@ QUnit.test('emoji popover should open correctly in thread windows', function (as QUnit.test('do not increase unread counter when receiving message with myself as author', function (assert) { assert.expect(4); - var generalChannelID = 1; - var myselfPartnerID = 44; - - this.data.initMessaging = { - channel_slots: { - channel_channel: [{ - id: generalChannelID, - channel_type: 'channel', - name: "general", - }], - }, - }; - var parent = this.createParent({ data: this.data, services: this.services, - session: { partner_id: myselfPartnerID } + session: { partner_id: 3 } }); // get channel instance to link to thread window @@ -228,14 +215,14 @@ QUnit.test('do not increase unread counter when receiving message with myself as // simulate receiving message from myself var messageData = { - author_id: [myselfPartnerID, "Myself"], + author_id: [3, "Myself"], body: "

Test message

", id: 2, model: 'mail.channel', res_id: 1, channel_ids: [1], }; - var notification = [[false, 'mail.channel', generalChannelID], messageData]; + var notification = [[false, 'mail.channel', 1], messageData]; parent.call('bus_service', 'trigger', 'notification', [notification]); threadWindowHeaderText = $('.o_thread_window_header').text().replace(/\s/g, ""); -- cgit v1.2.3