[FIX] mail: no '#' prefix in DM name

Before this commit, DMs had the prefix '#' in their
displayed name (e.g. '#Demo User').

This commit fixes the issue by putting this prefix
only on non-chat DMs. In particular, mailboxes, DMs
and Livechats no longer show this prefix. This change
is also visible in the breadcrumb of the discuss app.

Task-ID 1911738
This commit is contained in:
Alexandre Kühn
2018-11-26 08:47:36 +00:00
parent 07f6b8ef57
commit 341fb5f240
4 changed files with 14 additions and 14 deletions
+1 -1
View File
@@ -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);
@@ -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.
@@ -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
@@ -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();