diff --git a/addons/mail/static/src/js/discuss.js b/addons/mail/static/src/js/discuss.js index 032ab1bddef..e93adeaae30 100644 --- a/addons/mail/static/src/js/discuss.js +++ b/addons/mail/static/src/js/discuss.js @@ -852,7 +852,7 @@ var Discuss = AbstractAction.extend(ControlPanelMixin, { // Update control panel before focusing the composer, otherwise // focus is on the searchview - self.set("title", '#' + self._thread.getName()); + self.set("title", self._thread.getTitle()); self._updateControlPanel(); self._updateControlPanelButtons(self._thread); diff --git a/addons/mail/static/src/js/models/threads/channel.js b/addons/mail/static/src/js/models/threads/channel.js index 808e8b7fbca..7dc460ddc37 100644 --- a/addons/mail/static/src/js/models/threads/channel.js +++ b/addons/mail/static/src/js/models/threads/channel.js @@ -221,16 +221,6 @@ var Channel = SearchableThread.extend(ThreadTypingMixin, { isMyselfAuthor: this.hasMessages() && this.getLastMessage().isMyselfAuthor(), }); }, - /** - * Returns the title to display in thread window's headers. - * For channels, the title is prefixed with "#". - * - * @override - * @returns {string|Object} the name of the thread by default (see getName) - */ - getTitle: function () { - return "#" + this._super.apply(this, arguments); - }, /** * Get the UUID of the channel. * This is a string that uniquely links this channel to a server channel. diff --git a/addons/mail/static/src/js/models/threads/multi_user_channel.js b/addons/mail/static/src/js/models/threads/multi_user_channel.js index c1681744127..85d60fc1183 100644 --- a/addons/mail/static/src/js/models/threads/multi_user_channel.js +++ b/addons/mail/static/src/js/models/threads/multi_user_channel.js @@ -25,6 +25,16 @@ var MultiUserChannel = Channel.extend({ // Public //-------------------------------------------------------------------------- + /** + * Returns the title to display in thread window's headers. + * For channels, the title is prefixed with "#". + * + * @override + * @returns {string|Object} the name of the thread by default (see getName) + */ + getTitle: function () { + return "#" + this._super.apply(this, arguments); + }, /** * States whether this thread has the mass mailing setting active or not. * This is a server-side setting, that determine the type of composer that diff --git a/addons/mail/static/tests/thread_window/blank_thread_window_tests.js b/addons/mail/static/tests/thread_window/blank_thread_window_tests.js index 883494a4ec6..17654290c80 100644 --- a/addons/mail/static/tests/thread_window/blank_thread_window_tests.js +++ b/addons/mail/static/tests/thread_window/blank_thread_window_tests.js @@ -229,7 +229,7 @@ QUnit.test('open new DM chat from blank thread window', function (assert) { selectDef.then(function () { assert.strictEqual($('.o_thread_window').length, 1, "should be a single window"); - assert.strictEqual($('.o_thread_window_title').text().trim(), "#DemoUser1", + assert.strictEqual($('.o_thread_window_title').text().trim(), "DemoUser1", "should have thread window of the DM chat with 'DemoUser1'"); assert.strictEqual($('.o_composer_text_field').length, 1, "should have a composer in the DM chat window"); @@ -285,7 +285,7 @@ QUnit.test('open already detached DM chat from blank thread window', function (a assert.strictEqual($('.o_thread_window').length, 1, "should be a single window"); - assert.strictEqual($('.o_thread_window_title').text().trim(), "#DemoUser1", + assert.strictEqual($('.o_thread_window_title').text().trim(), "DemoUser1", "should have thread window of the DM chat with 'DemoUser1'"); assert.strictEqual($('.o_composer_text_field').length, 1, "should have a composer in the DM chat window"); @@ -304,7 +304,7 @@ QUnit.test('open already detached DM chat from blank thread window', function (a selectDef.then(function () { assert.strictEqual($('.o_thread_window').length, 1, "should now have a single thread window open"); - assert.strictEqual($('.o_thread_window_title').text().trim(), "#DemoUser1", + assert.strictEqual($('.o_thread_window_title').text().trim(), "DemoUser1", "the remaining thread window should be the DM chat with 'DemoUser1'"); self.unpatchAutocomplete();