[mirotalksfu] - add eject reason

هذا الالتزام موجود في:
Miroslav Pejic
2023-12-02 19:41:37 +01:00
الأصل f5732b473b
التزام 28c597c584

عرض الملف

@@ -729,7 +729,15 @@ class RoomClient {
'peerAction', 'peerAction',
function (data) { function (data) {
console.log('SocketOn Peer action:', data); console.log('SocketOn Peer action:', data);
this.peerAction(data.from_peer_name, data.peer_id, data.action, false, data.broadcast); this.peerAction(
data.from_peer_name,
data.peer_id,
data.action,
false,
data.broadcast,
true,
data.message,
);
}.bind(this), }.bind(this),
); );
@@ -5205,17 +5213,18 @@ class RoomClient {
// PEER ACTION // PEER ACTION
// #################################################### // ####################################################
peerAction(from_peer_name, id, action, emit = true, broadcast = false, info = true) { peerAction(from_peer_name, id, action, emit = true, broadcast = false, info = true, msg = '') {
const words = id.split('___'); const words = id.split('___');
let peer_id = words[0]; const peer_id = words[0];
if (emit) { if (emit) {
let data = { const data = {
from_peer_name: this.peer_name, from_peer_name: this.peer_name,
from_peer_id: this.peer_id, from_peer_id: this.peer_id,
from_peer_uuid: this.peer_uuid, from_peer_uuid: this.peer_uuid,
peer_id: peer_id, peer_id: peer_id,
action: action, action: action,
message: '',
broadcast: broadcast, broadcast: broadcast,
}; };
@@ -5265,9 +5274,12 @@ class RoomClient {
switch (action) { switch (action) {
case 'eject': case 'eject':
if (peer_id === this.peer_id || broadcast) { if (peer_id === this.peer_id || broadcast) {
const message = `Will eject you from the room${
msg ? `<br><br><span class="red">Reason: ${msg}</span>` : ''
}`;
this.exit(true); this.exit(true);
this.sound(action); this.sound(action);
this.peerActionProgress(from_peer_name, 'Will eject you from the room', 5000, action); this.peerActionProgress(from_peer_name, message, 5000, action);
} }
break; break;
case 'mute': case 'mute':
@@ -5319,7 +5331,7 @@ class RoomClient {
background: swalBackground, background: swalBackground,
icon: action == 'eject' ? 'warning' : 'success', icon: action == 'eject' ? 'warning' : 'success',
title: tt, title: tt,
text: msg, html: msg,
timer: time, timer: time,
timerProgressBar: true, timerProgressBar: true,
didOpen: () => { didOpen: () => {
@@ -5349,6 +5361,8 @@ class RoomClient {
position: 'center', position: 'center',
imageUrl: data.broadcast ? image.users : image.user, imageUrl: data.broadcast ? image.users : image.user,
title: 'Eject ' + whoEject, title: 'Eject ' + whoEject,
input: 'text',
inputPlaceholder: 'Eject reason',
showDenyButton: true, showDenyButton: true,
confirmButtonText: `Yes`, confirmButtonText: `Yes`,
denyButtonText: `No`, denyButtonText: `No`,
@@ -5358,6 +5372,8 @@ class RoomClient {
.then((result) => { .then((result) => {
if (result.isConfirmed) { if (result.isConfirmed) {
ejectConfirmed = true; ejectConfirmed = true;
const message = result.value;
if (message) data.message = message;
if (!data.broadcast) { if (!data.broadcast) {
this.socket.emit('peerAction', data); this.socket.emit('peerAction', data);
let peer = this.getId(data.peer_id); let peer = this.getId(data.peer_id);