mirror of
https://github.com/Vendicated/Vencord.git
synced 2025-02-24 23:38:32 +00:00
No longer creats two arrays onChange
This commit is contained in:
parent
4ac6d97ec8
commit
b20501dcfe
1 changed files with 7 additions and 4 deletions
|
@ -24,13 +24,16 @@ export const settings = definePluginSettings({
|
||||||
default: "",
|
default: "",
|
||||||
disabled: () => settings.store.alwaysPingOnReply,
|
disabled: () => settings.store.alwaysPingOnReply,
|
||||||
onChange: newValue => {
|
onChange: newValue => {
|
||||||
const originalIDs = newValue.split(",").map(id => id.trim()).filter(id => id !== "");
|
const originalIDs = newValue.split(",")
|
||||||
const validatedIDs = originalIDs.filter(isValidUserId);
|
.map(id => id.trim())
|
||||||
|
.filter(id => id !== "");
|
||||||
|
|
||||||
if (originalIDs.length !== validatedIDs.length) {
|
const isInvalid = originalIDs.some(id => !isValidUserId(id));
|
||||||
|
|
||||||
|
if (isInvalid) {
|
||||||
showToast("Invalid User ID: One or more User IDs in the whitelist are invalid. Please check your input.");
|
showToast("Invalid User ID: One or more User IDs in the whitelist are invalid. Please check your input.");
|
||||||
} else {
|
} else {
|
||||||
cachedWhitelist = validatedIDs;
|
cachedWhitelist = originalIDs;
|
||||||
showToast("Whitelist Updated: Reply ping whitelist has been successfully updated.");
|
showToast("Whitelist Updated: Reply ping whitelist has been successfully updated.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue