From ef8093e1b872b258b7b2ac2f8bb18fd4830b210c Mon Sep 17 00:00:00 2001 From: Andrew Date: Sat, 5 Jul 2025 16:54:12 -0400 Subject: [PATCH 1/4] Fix annoucements not showing after 4.4.10 --- app/frontend/templates/notify.html | 52 ++++++++++++++++++++++++++++-- 1 file changed, 50 insertions(+), 2 deletions(-) diff --git a/app/frontend/templates/notify.html b/app/frontend/templates/notify.html index 8601cb08..9a18cb89 100644 --- a/app/frontend/templates/notify.html +++ b/app/frontend/templates/notify.html @@ -97,17 +97,65 @@ image.src = "/static/assets/images/faces-clipart/pic-3.png"; return true; } + + + function createAnnouncementItem(value) { + const li = document.createElement("li"); + li.className = "card-header header-sm justify-content-between align-items-center annoucement-item"; + li.id = value.id; + + // Clear button + const iconWrapper = document.createElement("p"); + const icon = document.createElement("i"); + icon.className = "clear-button fa-regular fa-x"; + icon.dataset.id = value.id; + iconWrapper.appendChild(icon); + + // Link section + const a = document.createElement("a"); + a.href = sanitizeUrl(value.link); + a.target = "_blank"; + + const title = document.createElement("h6"); + title.className = "annoucement-title"; + title.textContent = value.title; + + const dateWrapper = document.createElement("small"); + const date = document.createElement("p"); + date.textContent = value.date; + dateWrapper.appendChild(date); + + const desc = document.createElement("p"); + desc.textContent = value.desc; + + // Assemble link + a.appendChild(title); + a.appendChild(dateWrapper); + a.appendChild(desc); + + // Assemble list item + li.appendChild(iconWrapper); + li.appendChild(a); + + return li; + } + + function sanitizeUrl(url) { + return /^https?:\/\//i.test(url) ? url : "#"; + } + function updateAnnouncements(data) { console.log(data); let text = ""; + const container = document.querySelector("#announcements"); for (let value of data) { - text += `
  • ${value.title}

    ${value.date}

    ${value.desc}

  • ` + let annc_item = createAnnouncementItem(value) + container.appendChild(annc_item); } if (data.length > 0) { localStorage.setItem("notif-count", data.length); $("#notif-count").show() $("#notif-count").text(data.length).html(); - $("#announcements").text(text).html(); } else { $("#announcements").text(`
  • `).html(); $("#notif-count").hide() -- GitLab From 25d9ca923ac269bd3cc1ac1a4e049c96a6c0f99e Mon Sep 17 00:00:00 2001 From: Andrew Date: Mon, 7 Jul 2025 12:19:40 -0400 Subject: [PATCH 2/4] Remove URL "sanitize" check --- app/frontend/templates/notify.html | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/app/frontend/templates/notify.html b/app/frontend/templates/notify.html index 9a18cb89..1682fe90 100644 --- a/app/frontend/templates/notify.html +++ b/app/frontend/templates/notify.html @@ -113,7 +113,7 @@ // Link section const a = document.createElement("a"); - a.href = sanitizeUrl(value.link); + a.href = value.link; a.target = "_blank"; const title = document.createElement("h6"); @@ -140,10 +140,6 @@ return li; } - function sanitizeUrl(url) { - return /^https?:\/\//i.test(url) ? url : "#"; - } - function updateAnnouncements(data) { console.log(data); let text = ""; -- GitLab From 6bdc833448171e44cf218a864a8aeef3585f7bd4 Mon Sep 17 00:00:00 2001 From: Andrew Date: Tue, 29 Jul 2025 15:07:40 -0400 Subject: [PATCH 3/4] Remove unused text var --- app/frontend/templates/notify.html | 1 - 1 file changed, 1 deletion(-) diff --git a/app/frontend/templates/notify.html b/app/frontend/templates/notify.html index 1682fe90..1b31b496 100644 --- a/app/frontend/templates/notify.html +++ b/app/frontend/templates/notify.html @@ -142,7 +142,6 @@ function updateAnnouncements(data) { console.log(data); - let text = ""; const container = document.querySelector("#announcements"); for (let value of data) { let annc_item = createAnnouncementItem(value) -- GitLab From 1abd5daccff42f27f16ce67ed58a01d2971b4f7d Mon Sep 17 00:00:00 2001 From: Zedifus Date: Wed, 30 Jul 2025 02:25:27 +0100 Subject: [PATCH 4/4] Update changelog !872 --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 38e39d0d..fc951c6e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ ### Bug fixes - Fixed inconsistent password schema error handling ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/868)) - Fix cvalidation to stop users being able to disable their own account ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/870)) +- Fix annoucements not showing after `4.4.10` ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/872)) ### Tweaks TBD ### Lang -- GitLab