Partially fix reminder usernames resetting

This commit is contained in:
jude 2023-08-07 21:50:11 +01:00
parent 6a94f990cf
commit 77f17c8dc2

View File

@ -66,19 +66,30 @@ function update_select(sel) {
return;
}
if (sel.selectedOptions[0].dataset["webhookAvatar"]) {
sel.closest("div.reminderContent").querySelector("img.discord-avatar").src =
sel.selectedOptions[0].dataset["webhookAvatar"];
} else {
sel.closest("div.reminderContent").querySelector("img.discord-avatar").src =
"/static/img/icon.png";
let isCreating = sel.closest("div.reminderContent").classList.contains("creator");
if (!isCreating) {
return;
}
if (sel.selectedOptions[0].dataset["webhookName"]) {
sel.closest("div.reminderContent").querySelector("input.discord-username").value =
sel.selectedOptions[0].dataset["webhookName"];
const avatarInput = sel
.closest("div.reminderContent")
.querySelector("img.discord-avatar");
if (sel.selectedOptions[0].dataset["webhookAvatar"]) {
avatarInput.src = sel.selectedOptions[0].dataset["webhookAvatar"];
} else {
sel.closest("div.reminderContent").querySelector("input.discord-username").value =
"Reminder";
avatarInput.src = "/static/img/icon.png";
}
const usernameInput = sel
.closest("div.reminderContent")
.querySelector("input.discord-username");
if (sel.selectedOptions[0].dataset["webhookName"]) {
usernameInput.value = sel.selectedOptions[0].dataset["webhookName"];
} else {
usernameInput.value = "Reminder";
}
}