[REF] mail: rename isMuted into isSelfMuted
This commit renames the isMuted variable into isSelfMuted to reflect the user action of self muting, as opposed to the state of being mute, which will be distinct in an upcoming commit. part of task-2720026 closes odoo/odoo#82199 Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
This commit is contained in:
@@ -104,7 +104,7 @@ class MailRtcSession(models.Model):
|
||||
vals.update({
|
||||
'isCameraOn': self.is_camera_on,
|
||||
'isDeaf': self.is_deaf,
|
||||
'isMuted': self.is_muted,
|
||||
'isSelfMuted': self.is_muted,
|
||||
'isScreenSharingOn': self.is_screen_sharing_on,
|
||||
})
|
||||
if self.guest_id:
|
||||
|
||||
+1
-1
@@ -49,7 +49,7 @@
|
||||
</t>
|
||||
</span>
|
||||
<div class="o_RtcCallParticipantCard_overlayTop">
|
||||
<t t-if="callParticipantCard.rtcSession.isMuted">
|
||||
<t t-if="callParticipantCard.rtcSession.isSelfMuted">
|
||||
<span class="o_RtcCallParticipantCard_overlayTopElement" t-att-class="{'o-isMinimized': callParticipantCard.isMinimized }" title="muted" aria-label="muted">
|
||||
<i class="fa fa-microphone-slash"/>
|
||||
</span>
|
||||
|
||||
@@ -6,19 +6,19 @@
|
||||
<t t-if="rtcController and messaging">
|
||||
<div class="o_RtcController_buttons">
|
||||
<t t-if="rtcController.callViewer.threadView.thread.rtc and messaging.rtc.currentRtcSession">
|
||||
<t t-if="messaging.rtc.currentRtcSession.isMuted"><t t-set="microphoneTitle">Unmute</t></t>
|
||||
<t t-if="messaging.rtc.currentRtcSession.isSelfMuted"><t t-set="microphoneTitle">Unmute</t></t>
|
||||
<t t-else=""><t t-set="microphoneTitle">Mute</t></t>
|
||||
<button class="o_RtcController_button"
|
||||
t-att-class="{ 'o-isActive': !messaging.rtc.currentRtcSession.isMuted, 'o-isSmall': rtcController.isSmall }"
|
||||
t-att-class="{ 'o-isActive': !messaging.rtc.currentRtcSession.isSelfMuted, 'o-isSmall': rtcController.isSmall }"
|
||||
t-att-aria-label="microphoneTitle"
|
||||
t-att-title="microphoneTitle"
|
||||
t-on-click="rtcController.onClickMicrophone">
|
||||
<div class="o_RtcController_buttonIconWrapper" t-att-class="{ 'o-isSmall': rtcController.isSmall }">
|
||||
<i class="fa" t-att-class="{
|
||||
'fa-lg': !rtcController.isSmall,
|
||||
'fa-microphone': !messaging.rtc.currentRtcSession.isMuted,
|
||||
'fa-microphone-slash': messaging.rtc.currentRtcSession.isMuted,
|
||||
'text-danger': messaging.rtc.currentRtcSession.isMuted,
|
||||
'fa-microphone': !messaging.rtc.currentRtcSession.isSelfMuted,
|
||||
'fa-microphone-slash': messaging.rtc.currentRtcSession.isSelfMuted,
|
||||
'text-danger': messaging.rtc.currentRtcSession.isSelfMuted,
|
||||
}"/>
|
||||
</div>
|
||||
</button>
|
||||
|
||||
@@ -37,9 +37,6 @@ registerModel({
|
||||
if ('id' in data) {
|
||||
data2.id = data.id;
|
||||
}
|
||||
if ('is_muted' in data) {
|
||||
data2.isMuted = data.is_muted;
|
||||
}
|
||||
if ('im_status' in data) {
|
||||
data2.im_status = data.im_status;
|
||||
}
|
||||
@@ -442,9 +439,6 @@ registerModel({
|
||||
isOnline: attr({
|
||||
compute: '_computeIsOnline',
|
||||
}),
|
||||
isMuted: attr({
|
||||
default: false,
|
||||
}),
|
||||
memberThreads: many2many('Thread', {
|
||||
inverse: 'members',
|
||||
}),
|
||||
|
||||
@@ -239,8 +239,8 @@ registerModel({
|
||||
* from the user
|
||||
*/
|
||||
async toggleMicrophone({ requestAudioDevice = true } = {}) {
|
||||
const shouldMute = this.currentRtcSession.isDeaf || !this.currentRtcSession.isMuted;
|
||||
this.currentRtcSession.updateAndBroadcast({ isMuted: shouldMute || !this.audioTrack });
|
||||
const shouldMute = this.currentRtcSession.isDeaf || !this.currentRtcSession.isSelfMuted;
|
||||
this.currentRtcSession.updateAndBroadcast({ isSelfMuted: shouldMute || !this.audioTrack });
|
||||
if (!this.audioTrack && !shouldMute && requestAudioDevice) {
|
||||
// if we don't have an audioTrack, we try to request it again
|
||||
await this.updateLocalAudioTrack(true);
|
||||
@@ -284,7 +284,7 @@ registerModel({
|
||||
type: 'warning',
|
||||
});
|
||||
if (this.currentRtcSession) {
|
||||
this.currentRtcSession.updateAndBroadcast({ isMuted: true });
|
||||
this.currentRtcSession.updateAndBroadcast({ isSelfMuted: true });
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -297,11 +297,11 @@ registerModel({
|
||||
audioTrack.addEventListener('ended', async () => {
|
||||
// this mostly happens when the user retracts microphone permission.
|
||||
await this.async(() => this.updateLocalAudioTrack(false));
|
||||
this.currentRtcSession.updateAndBroadcast({ isMuted: true });
|
||||
this.currentRtcSession.updateAndBroadcast({ isSelfMuted: true });
|
||||
await this.async(() => this._updateLocalAudioTrackEnabledState());
|
||||
});
|
||||
this.currentRtcSession.updateAndBroadcast({ isMuted: false });
|
||||
audioTrack.enabled = !this.currentRtcSession.isMuted && this.currentRtcSession.isTalking;
|
||||
this.currentRtcSession.updateAndBroadcast({ isSelfMuted: false });
|
||||
audioTrack.enabled = !this.currentRtcSession.isSelfMuted && this.currentRtcSession.isTalking;
|
||||
this.update({ audioTrack });
|
||||
await this.async(() => this.updateVoiceActivation());
|
||||
for (const [token, peerConnection] of Object.entries(this._peerConnections)) {
|
||||
@@ -483,7 +483,7 @@ registerModel({
|
||||
type: 'peerToPeer',
|
||||
payload: {
|
||||
type: 'audio',
|
||||
state: { isTalking: this.currentRtcSession.isTalking, isMuted: this.currentRtcSession.isMuted },
|
||||
state: { isTalking: this.currentRtcSession.isTalking, isSelfMuted: this.currentRtcSession.isSelfMuted },
|
||||
},
|
||||
});
|
||||
} catch (e) {
|
||||
@@ -604,13 +604,13 @@ registerModel({
|
||||
* @param {Object} param1.state
|
||||
*/
|
||||
_handleTrackChange(rtcSession, { type, state }) {
|
||||
const { isMuted, isTalking, isSendingVideo, isDeaf } = state;
|
||||
const { isSelfMuted, isTalking, isSendingVideo, isDeaf } = state;
|
||||
if (type === 'audio') {
|
||||
if (!rtcSession.audioStream) {
|
||||
return;
|
||||
}
|
||||
rtcSession.update({
|
||||
isMuted,
|
||||
isSelfMuted,
|
||||
isTalking,
|
||||
isDeaf,
|
||||
});
|
||||
@@ -849,7 +849,7 @@ registerModel({
|
||||
return;
|
||||
}
|
||||
this.currentRtcSession.update({ isTalking });
|
||||
if (!this.currentRtcSession.isMuted) {
|
||||
if (!this.currentRtcSession.isSelfMuted) {
|
||||
await this._updateLocalAudioTrackEnabledState();
|
||||
}
|
||||
},
|
||||
@@ -915,7 +915,7 @@ registerModel({
|
||||
if (track.kind === 'audio') {
|
||||
rtcSession.setAudio({
|
||||
audioStream: stream,
|
||||
isMuted: false,
|
||||
isSelfMuted: false,
|
||||
isTalking: false,
|
||||
});
|
||||
}
|
||||
@@ -935,15 +935,15 @@ registerModel({
|
||||
if (!this.audioTrack) {
|
||||
return;
|
||||
}
|
||||
this.audioTrack.enabled = !this.currentRtcSession.isMuted && this.currentRtcSession.isTalking;
|
||||
this.audioTrack.enabled = !this.currentRtcSession.isSelfMuted && this.currentRtcSession.isTalking;
|
||||
await this._notifyPeers(Object.keys(this._peerConnections), {
|
||||
event: 'trackChange',
|
||||
type: 'peerToPeer',
|
||||
payload: {
|
||||
type: 'audio',
|
||||
state: {
|
||||
isTalking: this.currentRtcSession.isTalking && !this.currentRtcSession.isMuted,
|
||||
isMuted: this.currentRtcSession.isMuted,
|
||||
isTalking: this.currentRtcSession.isTalking && !this.currentRtcSession.isSelfMuted,
|
||||
isSelfMuted: this.currentRtcSession.isSelfMuted,
|
||||
isDeaf: this.currentRtcSession.isDeaf,
|
||||
},
|
||||
},
|
||||
@@ -1126,7 +1126,7 @@ registerModel({
|
||||
if (this._pushToTalkTimeoutId) {
|
||||
browser.clearTimeout(this._pushToTalkTimeoutId);
|
||||
}
|
||||
if (!this.currentRtcSession.isTalking && !this.currentRtcSession.isMuted) {
|
||||
if (!this.currentRtcSession.isTalking && !this.currentRtcSession.isSelfMuted) {
|
||||
this.messaging.soundEffects.pushToTalk.play({ volume: 0.3 });
|
||||
}
|
||||
this._setSoundBroadcast(true);
|
||||
@@ -1145,7 +1145,7 @@ registerModel({
|
||||
if (!this.currentRtcSession.isTalking) {
|
||||
return;
|
||||
}
|
||||
if (!this.currentRtcSession.isMuted) {
|
||||
if (!this.currentRtcSession.isSelfMuted) {
|
||||
this.messaging.soundEffects.pushToTalk.play({ volume: 0.3 });
|
||||
}
|
||||
this._pushToTalkTimeoutId = browser.setTimeout(
|
||||
|
||||
+1
-1
@@ -94,7 +94,7 @@ registerModel({
|
||||
* @returns {boolean}
|
||||
*/
|
||||
_computeIsTalking() {
|
||||
return Boolean(this.rtcSession && this.rtcSession.isTalking && !this.rtcSession.isMuted);
|
||||
return Boolean(this.rtcSession && this.rtcSession.isTalking && !this.rtcSession.isSelfMuted);
|
||||
},
|
||||
/**
|
||||
* @private
|
||||
|
||||
@@ -46,10 +46,10 @@ registerModel({
|
||||
/**
|
||||
* @param {Object} param0
|
||||
* @param {MediaStream} param0.audioStream
|
||||
* @param {boolean} param0.isMuted
|
||||
* @param {boolean} param0.isSelfMuted
|
||||
* @param {boolean} param0.isTalking
|
||||
*/
|
||||
async setAudio({ audioStream, isMuted, isTalking }) {
|
||||
async setAudio({ audioStream, isSelfMuted, isTalking }) {
|
||||
const audioElement = this.audioElement || new window.Audio();
|
||||
try {
|
||||
audioElement.srcObject = audioStream;
|
||||
@@ -72,7 +72,7 @@ registerModel({
|
||||
this.update({
|
||||
audioElement,
|
||||
audioStream,
|
||||
isMuted,
|
||||
isSelfMuted,
|
||||
isTalking,
|
||||
});
|
||||
try {
|
||||
@@ -173,7 +173,7 @@ registerModel({
|
||||
values: {
|
||||
is_camera_on: this.isCameraOn,
|
||||
is_deaf: this.isDeaf,
|
||||
is_muted: this.isMuted,
|
||||
is_muted: this.isSelfMuted,
|
||||
is_screen_sharing_on: this.isScreenSharingOn,
|
||||
},
|
||||
},
|
||||
@@ -351,7 +351,7 @@ registerModel({
|
||||
* means that they cannot send sound regardless of the push to talk or
|
||||
* voice activation (isTalking) state.
|
||||
*/
|
||||
isMuted: attr({
|
||||
isSelfMuted: attr({
|
||||
default: false,
|
||||
}),
|
||||
/**
|
||||
|
||||
@@ -49,7 +49,7 @@ class TestChannelInternals(MailCommon):
|
||||
'id': channel_partner.rtc_session_ids.id + 1,
|
||||
'isCameraOn': False,
|
||||
'isDeaf': False,
|
||||
'isMuted': False,
|
||||
'isSelfMuted': False,
|
||||
'isScreenSharingOn': False,
|
||||
'partner': [('insert', {
|
||||
'id': self.user_employee.partner_id.id,
|
||||
@@ -68,7 +68,7 @@ class TestChannelInternals(MailCommon):
|
||||
'id': channel_partner.rtc_session_ids.id,
|
||||
'isCameraOn': False,
|
||||
'isDeaf': False,
|
||||
'isMuted': False,
|
||||
'isSelfMuted': False,
|
||||
'isScreenSharingOn': False,
|
||||
'partner': [('insert', {
|
||||
'id': self.user_employee.partner_id.id,
|
||||
@@ -109,7 +109,7 @@ class TestChannelInternals(MailCommon):
|
||||
'id': last_rtc_session_id + 1,
|
||||
'isCameraOn': False,
|
||||
'isDeaf': False,
|
||||
'isMuted': False,
|
||||
'isSelfMuted': False,
|
||||
'isScreenSharingOn': False,
|
||||
'partner': [('insert', {
|
||||
'id': self.user_employee.partner_id.id,
|
||||
@@ -164,7 +164,7 @@ class TestChannelInternals(MailCommon):
|
||||
'id': last_rtc_session_id + 1,
|
||||
'isCameraOn': False,
|
||||
'isDeaf': False,
|
||||
'isMuted': False,
|
||||
'isSelfMuted': False,
|
||||
'isScreenSharingOn': False,
|
||||
'partner': [('insert', {
|
||||
'id': self.user_employee.partner_id.id,
|
||||
@@ -181,7 +181,7 @@ class TestChannelInternals(MailCommon):
|
||||
'id': last_rtc_session_id + 1,
|
||||
'isCameraOn': False,
|
||||
'isDeaf': False,
|
||||
'isMuted': False,
|
||||
'isSelfMuted': False,
|
||||
'isScreenSharingOn': False,
|
||||
'partner': [('insert', {
|
||||
'id': self.user_employee.partner_id.id,
|
||||
@@ -248,7 +248,7 @@ class TestChannelInternals(MailCommon):
|
||||
'id': channel_partner.rtc_session_ids.id + 1,
|
||||
'isCameraOn': False,
|
||||
'isDeaf': False,
|
||||
'isMuted': False,
|
||||
'isSelfMuted': False,
|
||||
'isScreenSharingOn': False,
|
||||
'partner': [('insert', {
|
||||
'id': test_user.partner_id.id,
|
||||
@@ -294,7 +294,7 @@ class TestChannelInternals(MailCommon):
|
||||
'id': channel_partner.rtc_session_ids.id + 2,
|
||||
'isCameraOn': False,
|
||||
'isDeaf': False,
|
||||
'isMuted': False,
|
||||
'isSelfMuted': False,
|
||||
'isScreenSharingOn': False,
|
||||
'guest': [('insert', {
|
||||
'id': test_guest.id,
|
||||
@@ -462,7 +462,7 @@ class TestChannelInternals(MailCommon):
|
||||
'id': channel_partner.rtc_session_ids.id,
|
||||
'isCameraOn': False,
|
||||
'isDeaf': False,
|
||||
'isMuted': False,
|
||||
'isSelfMuted': False,
|
||||
'isScreenSharingOn': False,
|
||||
'partner': [('insert', {
|
||||
'id': self.user_employee.partner_id.id,
|
||||
@@ -479,7 +479,7 @@ class TestChannelInternals(MailCommon):
|
||||
'id': channel_partner.rtc_session_ids.id,
|
||||
'isCameraOn': False,
|
||||
'isDeaf': False,
|
||||
'isMuted': False,
|
||||
'isSelfMuted': False,
|
||||
'isScreenSharingOn': False,
|
||||
'partner': [('insert', {
|
||||
'id': self.user_employee.partner_id.id,
|
||||
|
||||
Reference in New Issue
Block a user