Resync Mutes and Boots on reconnect to server
This commit is contained in:
parent
139f9ece70
commit
aa162a5b7a
47
src/App.vue
47
src/App.vue
|
@ -936,6 +936,13 @@ export default {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DEBUGGING: reconnect to the server
|
||||||
|
if (this.message.toLowerCase().indexOf("/reconnect") === 0) {
|
||||||
|
this.resetChatClient();
|
||||||
|
this.message = "";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// console.debug("Send message: %s", this.message);
|
// console.debug("Send message: %s", this.message);
|
||||||
this.client.send({
|
this.client.send({
|
||||||
action: "message",
|
action: "message",
|
||||||
|
@ -1171,23 +1178,39 @@ export default {
|
||||||
bulkMuteUsers() {
|
bulkMuteUsers() {
|
||||||
// On page load, if the website sent you a CachedBlocklist, mute all
|
// On page load, if the website sent you a CachedBlocklist, mute all
|
||||||
// of these users in bulk when the server connects.
|
// of these users in bulk when the server connects.
|
||||||
// this.ChatClient("BulkMuteUsers: sending our blocklist " + this.config.CachedBlocklist);
|
|
||||||
|
|
||||||
if (this.config.CachedBlocklist.length === 0) {
|
// If we have a blocklist from the main website, sync it to the server now.
|
||||||
return; // nothing to do
|
let mapBlockedUsers = {}; // usernames on our website blocklist
|
||||||
|
if (this.config.CachedBlocklist.length > 0) {
|
||||||
|
// Set the client side mute.
|
||||||
|
let blocklist = this.config.CachedBlocklist;
|
||||||
|
for (let username of blocklist) {
|
||||||
|
mapBlockedUsers[username] = true;
|
||||||
|
this.muted[username] = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Send the username list to the server.
|
||||||
|
this.client.send({
|
||||||
|
action: "blocklist",
|
||||||
|
usernames: blocklist,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the client side mute.
|
// While we're here, also re-sync our Boot list. e.g.: we were on webcam and we
|
||||||
let blocklist = this.config.CachedBlocklist;
|
// booted someone off, then we got temporarily disconnected. The server has forgotten who
|
||||||
for (let username of blocklist) {
|
// we booted and that person could then see our cam again.
|
||||||
this.muted[username] = true;
|
for (let username of Object.keys(this.WebRTC.booted)) {
|
||||||
|
// Boot them again.
|
||||||
|
this.sendBoot(username);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send the username list to the server.
|
// Apply any temporary mutes that we had before the reconnect. Note: these are distinct
|
||||||
this.client.send({
|
// from blocks - blocks will make people invisible both ways to each other, mutes only
|
||||||
action: "blocklist",
|
// suppress messages but their Who List presence is maintained to each other.
|
||||||
usernames: blocklist,
|
for (let username of Object.keys(this.muted)) {
|
||||||
});
|
if (mapBlockedUsers[username]) continue;
|
||||||
|
this.sendMute(username, true);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// Send a video request to access a user's camera.
|
// Send a video request to access a user's camera.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user