You can not open the camera of someone you have muted

This commit is contained in:
Noah 2023-06-14 21:06:57 -07:00
parent b767620699
commit 2da08aa67a
2 changed files with 26 additions and 2 deletions

View File

@ -430,6 +430,9 @@ const app = Vue.createApp({
delete this.muted[username];
}
// Hang up videos both ways.
this.closeVideo(username);
this.sendMute(username, mute);
if (mute) {
this.ChatClient(
@ -1057,6 +1060,12 @@ const app = Vue.createApp({
return;
}
// If we have muted the target, we shouldn't view their video.
if (this.isMutedUser(user.username)) {
this.ChatClient(`You have muted <strong>${user.username}</strong> and so should not see their camera.`);
return;
}
// Is the target user NSFW? Go thru the modal.
let dontShowAgain = localStorage["skip-nsfw-modal"] == "true";
if (user.nsfw && !dontShowAgain && !force) {
@ -1135,6 +1144,21 @@ const app = Vue.createApp({
}
}
},
isVideoNotAllowed(user) {
// Returns whether the video button to open a user's cam will be not allowed (crossed out)
// Mutual video sharing is required on this camera, and ours is not active
if (user.videoActive && user.videoMutual && !this.webcam.active) {
return true;
}
// We have muted them and it wouldn't be appropriate to still watch their video but not get their messages.
if (this.isMutedUser(user.username)) {
return true;
}
return false;
},
// Show who watches our video.
showViewers() {

View File

@ -999,7 +999,7 @@
:class="{
'is-danger is-outlined': u.videoActive && u.nsfw,
'is-info is-outlined': u.videoActive && !u.nsfw,
'cursor-notallowed': u.videoActive && u.videoMutual && !webcam.active,
'cursor-notallowed': isVideoNotAllowed(u),
}"
:title="`Open video stream` +
(u.videoActive && u.videoMutual ? '; mutual video sharing required' : '') +
@ -1007,7 +1007,7 @@
@click="openVideo(u)">
<i class="fa"
:class="u.videoActive && u.videoMutual && !webcam.active ? 'fa-video-slash' : 'fa-video'"></i>
:class="isVideoNotAllowed(u) ? 'fa-video-slash' : 'fa-video'"></i>
</button>
</div>
</div>