[FIX] mail: remove "Please wait..." in Discuss when ready

Revision on https://github.com/odoo/odoo/commit/9a66619db33fca5f0cb81d9f6bfeb0fb0290cf68

Commit above improved webclient loading by not having to wait for
the RPC `/mail/init_messaging`.

It introduced an issue in which Discuss app was indefinitely showing
"Please wait...". This commit fixes this issue.

closes odoo/odoo#37337

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
This commit is contained in:
Alexandre Kühn
2019-09-24 12:23:22 +00:00
parent a5835a160e
commit af26c70469
2 changed files with 55 additions and 2 deletions
+1 -1
View File
@@ -506,6 +506,7 @@ var Discuss = AbstractAction.extend({
*/
_initRender: function () {
var self = this;
this.$('.o_mail_discuss_loading').remove();
this._basicComposer = new BasicComposer(this, {
mentionPartnersRestricted: true,
showTyping: true,
@@ -1420,7 +1421,6 @@ var Discuss = AbstractAction.extend({
if (!this._isStarted) {
return;
}
this.$('.o_mail_discuss_loading').remove();
this._initRender();
},
/**
+54 -1
View File
@@ -1,9 +1,9 @@
odoo.define('mail.discuss_test', function (require) {
"use strict";
const Discuss = require('mail.Discuss');
var mailTestUtils = require('mail.testUtils');
var concurrency = require('web.concurrency');
var testUtils = require('web.test_utils');
var createDiscuss = mailTestUtils.createDiscuss;
@@ -165,6 +165,59 @@ QUnit.test('messaging not ready', async function (assert) {
discuss.destroy();
});
QUnit.test('messaging initially ready', async function (assert) {
assert.expect(7);
const startDiscussProm = testUtils.makeTestPromise();
testUtils.mock.patch(Discuss, {
/**
* @override
*/
async start() {
const _super = this._super.bind(this, ...arguments); // due to limitation of class.js
assert.step('discuss:starting');
await startDiscussProm;
assert.step('discuss:started');
return _super();
},
});
const discussProm = createDiscuss({
id: 1,
context: {},
params: {},
data: this.data,
services: this.services,
mockRPC(route) {
if (route === '/mail/init_messaging') {
assert.step(route);
}
return this._super(...arguments);
}
});
await testUtils.nextTick();
assert.verifySteps([
'/mail/init_messaging',
'discuss:starting',
]);
startDiscussProm.resolve();
await testUtils.nextTick();
assert.verifySteps(['discuss:started']);
const discuss = await discussProm;
assert.ok(
discuss.el,
"discuss should be rendered");
assert.containsNone(
discuss,
'.o_mail_discuss_loading',
"should not display sidebar or content is loading (messaging is ready)");
testUtils.mock.unpatch(Discuss);
discuss.destroy();
});
QUnit.test('searchview options visibility', async function (assert) {
assert.expect(5);