From 400e9705e5ec1dfb47277b72eb8c1487c2c7ee9c Mon Sep 17 00:00:00 2001 From: AntonMacG Date: Mon, 13 Nov 2023 10:12:31 +0000 Subject: [PATCH] :husk: --- src/plugins/replyPingControl/index.ts | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/src/plugins/replyPingControl/index.ts b/src/plugins/replyPingControl/index.ts index 3c9cdd15f..a6aaf7f90 100644 --- a/src/plugins/replyPingControl/index.ts +++ b/src/plugins/replyPingControl/index.ts @@ -24,10 +24,12 @@ export const settings = definePluginSettings({ default: "", disabled: () => settings.store.alwaysPingOnReply, onChange: newValue => { - cachedWhitelist = parseWhitelist(newValue); - if (!validateWhitelist(newValue)) { + const newWhitelist = parseWhitelist(newValue); + + if (newWhitelist.length === 0 && newValue.trim() !== "") { showToast("Invalid User ID: One or more User IDs in the whitelist are invalid. Please check your input."); } else { + cachedWhitelist = newWhitelist; showToast("Whitelist Updated: Reply ping whitelist has been successfully updated."); } } @@ -73,16 +75,6 @@ export default definePlugin({ }, }); -function validateWhitelist(value: string) { - const whitelist = parseWhitelist(value); - if (whitelist.length === 0 && value.trim() !== "") { - showToast("Invalid User ID: One or more User IDs in the whitelist are invalid. Please check your input."); - return false; - } - showToast("Whitelist Updated: Reply ping whitelist has been successfully updated."); - return true; -} - function parseWhitelist(value: string) { return value.split(",") .map(id => id.trim())