Skip to content
Snippets Groups Projects
Commit deeac9a9 authored by Sébastien Theys's avatar Sébastien Theys
Browse files

[FIX] mail: don't show media preview on guest page if not meeting


closes odoo/odoo#77939

X-original-commit: 51eb2c9d
Signed-off-by: default avatarSébastien Theys (seb) <seb@odoo.com>
parent 35a7c559
No related branches found
No related tags found
No related merge requests found
......@@ -4,10 +4,13 @@
<t t-name="mail.WelcomeView" owl="1">
<div class="o_WelcomeView h-100 d-flex flex-column justify-content-center align-items-center bg-light">
<t t-if="welcomeView">
<h1 class="font-weight-light">You've been invited to a meeting!</h1>
<h1 class="font-weight-light">
<span t-if="welcomeView.mediaPreview">You've been invited to a meeting!</span>
<span t-if="!welcomeView.mediaPreview">You've been invited to a chat!</span>
</h1>
<h2 class="m-5" t-esc="messaging.companyName"/>
<div class="d-flex justify-content-center">
<MediaPreview class="mr-5" localId="welcomeView.mediaPreview.localId"/>
<MediaPreview t-if="welcomeView.mediaPreview" class="mr-5" localId="welcomeView.mediaPreview.localId"/>
<div class="d-flex flex-column justify-content-center">
<t t-if="messaging.currentGuest">
<label class="o_WelcomeView_guestNameInputLabel text-center" t-att-for="welcomeView.guestNameInputUniqueId">What's your name?</label>
......
......@@ -49,7 +49,7 @@ function factory(dependencies) {
pendingGuestName: this.messaging.currentGuest && this.messaging.currentGuest.name,
}),
});
if (this.channel.defaultDisplayMode === 'video_full_screen') {
if (this.welcomeView.mediaPreview) {
this.welcomeView.mediaPreview.enableMicrophone();
this.welcomeView.mediaPreview.enableVideo();
}
......
......@@ -2,7 +2,7 @@
import { registerNewModel } from '@mail/model/model_core';
import { attr, one2one } from '@mail/model/model_field';
import { insertAndReplace } from '@mail/model/model_field_command';
import { clear, insertAndReplace } from '@mail/model/model_field_command';
function factory(dependencies) {
......@@ -117,6 +117,16 @@ function factory(dependencies) {
return Boolean(this.messaging.currentGuest && this.pendingGuestName.trim() === '');
}
/**
* @private
* @returns {FieldCommand}
*/
_computeMediaPreview() {
return (this.channel && this.channel.defaultDisplayMode === 'video_full_screen')
? insertAndReplace()
: clear();
}
/**
* @private
*/
......@@ -205,10 +215,9 @@ function factory(dependencies) {
* States the media preview embedded in this welcome view.
*/
mediaPreview: one2one('mail.media_preview', {
default: insertAndReplace(),
compute: '_computeMediaPreview',
isCausal: true,
readonly: true,
required: true,
}),
/**
* States the name the guest had when landing on the welcome view.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment