From 6f4fd15095d121f158bab06b78c1ae50d7707b61 Mon Sep 17 00:00:00 2001 From: ouoertheo Date: Mon, 31 Jul 2023 08:24:51 -0500 Subject: [PATCH 1/2] currentTask fix in MESSAGE_RECEIVED, ingore swipes --- public/scripts/extensions/objective/index.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/public/scripts/extensions/objective/index.js b/public/scripts/extensions/objective/index.js index 6785d5d3b..1b9a78284 100644 --- a/public/scripts/extensions/objective/index.js +++ b/public/scripts/extensions/objective/index.js @@ -17,6 +17,7 @@ let currentChatId = "" let currentObjective = null let currentTask = null let checkCounter = 0 +let lastMessageWasSwipe = false const defaultPrompts = { @@ -783,9 +784,12 @@ jQuery(() => { eventSource.on(event_types.CHAT_CHANGED, () => { resetState() }); - + eventSource.on(event_types.MESSAGE_SWIPED, () => { + lastMessageWasSwipe = true + }) eventSource.on(event_types.MESSAGE_RECEIVED, () => { - if (currentChatId == undefined || currentTask == undefined) { + if (currentChatId == undefined || jQuery.isEmptyObject(currentTask) || lastMessageWasSwipe) { + lastMessageWasSwipe = false return } if ($("#objective-check-frequency").val() > 0) { From 9a4d62ca6fb83c0e3e224a8cf8ac8b2d47c6dd08 Mon Sep 17 00:00:00 2001 From: ouoertheo Date: Tue, 1 Aug 2023 16:16:52 -0500 Subject: [PATCH 2/2] add lastMessageWasSwipe=false to resetState --- public/scripts/extensions/objective/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/public/scripts/extensions/objective/index.js b/public/scripts/extensions/objective/index.js index 1b9a78284..c9148e114 100644 --- a/public/scripts/extensions/objective/index.js +++ b/public/scripts/extensions/objective/index.js @@ -517,6 +517,7 @@ const defaultSettings = { // Convenient single call. Not much at the moment. function resetState() { + lastMessageWasSwipe = false loadSettings(); }