1
Fork 0
mirror of https://github.com/jech/galene.git synced 2024-12-25 08:45:48 +01:00

Fix client-side selective clearChat.

We were correctly clearing the chat on the server side, but
we were leaving stray entries in the client.

Thanks to J.-J. Sarton.
This commit is contained in:
Juliusz Chroboczek 2024-12-24 01:06:10 +01:00
parent 2c56143ba0
commit e8b12d3729

View file

@ -3319,16 +3319,19 @@ function clearChat(id, userId) {
}
let elts = box.children;
for(let i = 0; i < elts.length; i++) {
let i = 0;
while(i < elts.length) {
let row = elts.item(i);
if(!(row instanceof HTMLDivElement))
continue;
let div = row.firstChild;
console.log(div);
if(!(div instanceof HTMLDivElement))
continue;
if((!id || div.dataset.id === id) && div.dataset.peerId === userId)
box.removeChild(row);
if(row instanceof HTMLDivElement) {
let div = row.firstChild;
if(div instanceof HTMLDivElement)
if((!id || div.dataset.id === id) &&
div.dataset.peerId === userId) {
box.removeChild(row);
continue;
}
}
i++;
}
}