Fix:Server crash when deleting library item #2031

This commit is contained in:
advplyr 2023-08-26 16:33:27 -05:00
parent a3899b68e1
commit a38e43213d
8 changed files with 437 additions and 20 deletions

View file

@ -34,9 +34,12 @@ class SocketAuthority {
return Object.values(this.clients).filter(c => c.user && c.user.id === userId)
}
// Emits event to all authorized clients
// optional filter function to only send event to specific users
// TODO: validate that filter is actually a function
/**
* Emits event to all authorized clients
* @param {string} evt
* @param {any} data
* @param {Function} [filter] optional filter function to only send event to specific users
*/
emitter(evt, data, filter = null) {
for (const socketId in this.clients) {
if (this.clients[socketId].user) {