From 10eb940d16f4f1b4a631b91fe8104dcfc80a0ad4 Mon Sep 17 00:00:00 2001 From: carykees98 Date: Thu, 7 Sep 2023 13:57:09 -0400 Subject: [PATCH] prevents old talks from being hidden --- static/site.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/static/site.js b/static/site.js index 3b59e1d..8c4f566 100644 --- a/static/site.js +++ b/static/site.js @@ -124,6 +124,9 @@ function connect() { sync(); }; socket.onmessage = function (e) { + const date = new Date(); + const presentWeek = date.parse("YYYYMMDD"); + const data = JSON.parse(e.data); console.log("Received:", data); @@ -132,8 +135,10 @@ function connect() { addTalk(data.new); seen.add(data.new.id); } else if (data.type == 1 || data.type == 2) { - // Hide the talk from the table - hideTalk(data.hide.id); + if (!(week < presentWeek)){ + // Hide the talk from the table + hideTalk(data.hide.id); + } } else if (data.type == 3) { // Receiving an auth message means we have successfully authenticated handleAuth(data.auth);