Fix duplicating reminder fields

This commit is contained in:
jude 2023-08-03 19:57:28 +01:00
parent fa83fed1af
commit 3aa5bd37aa

View File

@ -385,7 +385,14 @@ function deserialize_reminder(reminder, frame, mode) {
update_interval(frame); update_interval(frame);
update_select(frame.querySelector(".channel-selector")); update_select(frame.querySelector(".channel-selector"));
const lastChild = frame.querySelector("div.embed-multifield-box .embed-field-box"); const lastChild = frame.querySelector(
"div.embed-multifield-box .embed-field-box:last-child"
);
// Drop existing fields
frame
.querySelectorAll(".embed-field-box:not(:last-child)")
.forEach((el) => el.remove());
for (let field of reminder["embed_fields"] || []) { for (let field of reminder["embed_fields"] || []) {
let embed_field = $embedFieldTemplate.content.cloneNode(true); let embed_field = $embedFieldTemplate.content.cloneNode(true);
@ -1037,7 +1044,7 @@ document.addEventListener("click", (ev) => {
}); });
document.addEventListener("DOMContentLoaded", () => { document.addEventListener("DOMContentLoaded", () => {
let now = new Date(); let now = luxon.DateTime.now().setZone(timezone);
document.querySelectorAll(".prefill-now").forEach((el) => { document.querySelectorAll(".prefill-now").forEach((el) => {
el.value = now.toFormat("yyyy-LL-dd'T'HH:mm:ss"); el.value = now.toFormat("yyyy-LL-dd'T'HH:mm:ss");
}); });