[IMP] web_editor: allow collaboration for portal users

Encapsulate the `mail` ICE servers availability check in an overridable
function, since the hack does not work in a portal context, but Knowledge portal
users should be allowed to use the collaborative feature. Knowledge will
override the session check by always returning true, since mail is a dependency
of Knowledge and is therefore always installed with it.

Allow access to the edition channel for portal users.

task-3378266

X-original-commit: odoo/odoo@03e1148ac9
Part-of: odoo/odoo#128962
This commit is contained in:
abd-msyukyu-odoo
2023-07-28 14:53:42 +02:00
parent b19f2f9166
commit 24c3095532
2 changed files with 8 additions and 3 deletions
+1 -1
View File
@@ -23,7 +23,7 @@ class IrWebsocket(models.AbstractModel):
res_id = int(match[3])
# Verify access to the edition channel.
if not self.env.user._is_internal():
if self.env.user._is_public():
raise AccessDenied()
document = self.env[model_name].browse([res_id])
@@ -324,8 +324,7 @@ export class Wysiwyg extends Component {
let editorCollaborationOptions;
if (
options.collaborationChannel &&
// Hack: check if mail module is installed.
session.notification_type
this._hasICEServers()
) {
editorCollaborationOptions = this.setupCollaboration(options.collaborationChannel);
if (this.options.collaborativeTrigger === 'start') {
@@ -2864,6 +2863,12 @@ export class Wysiwyg extends Component {
_bindOnBlur() {
this.$editable.on('blur', this._onBlur);
}
_hasICEServers() {
// Hack: check if mail module is installed.
session.notification_type
}
/**
* Saves a base64 encoded image as an attachment.
* Relies on _saveModifiedImage being called after it for webp.