[FIX] web_editor: ensure the bus is available

In the frontend of project, the bus service is not available.
Since #129785, the test `portal_project_sharing_tour` crash
because `this.busService` is `undefined` when we try to access
it in `Wysiwyg.setupCollaboration`.

task-3434068

closes odoo/odoo#133477

Related: odoo/enterprise#46479
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
This commit is contained in:
Nicolas Bayet
2023-09-06 11:50:50 +00:00
parent 6333ac0b69
commit 0d4d0409ec
@@ -325,10 +325,7 @@ export class Wysiwyg extends Component {
const powerboxOptions = this._getPowerboxOptions();
let editorCollaborationOptions;
if (
options.collaborationChannel &&
this._hasICEServers()
) {
if (this._isCollaborationEnabled(options)) {
editorCollaborationOptions = this.setupCollaboration(options.collaborationChannel);
if (this.options.collaborativeTrigger === 'start') {
this._joinPeerToPeer();
@@ -2878,7 +2875,7 @@ export class Wysiwyg extends Component {
this._stopPeerToPeer();
this._rulesCache = undefined; // Reset the cache of rules.
// If there is no collaborationResId, the record has been deleted.
if (!collaborationChannel || !collaborationChannel.collaborationResId) {
if (!this._isCollaborationEnabled(this.options)) {
this.setValue(value);
this.odooEditor.historyReset();
return;
@@ -2931,6 +2928,9 @@ export class Wysiwyg extends Component {
// Hack: check if mail module is installed.
return session.notification_type;
}
_isCollaborationEnabled(options) {
return options.collaborationChannel && options.collaborationChannel.collaborationResId && this._hasICEServers() && this.busService;
}
/**
* Saves a base64 encoded image as an attachment.