Notify voters when suggestions change during refresh

This commit is contained in:
2026-02-06 23:19:34 +01:00
parent b75e25fb92
commit b2b3996d78
3 changed files with 39 additions and 1 deletions

View File

@@ -172,6 +172,7 @@ export function renderAllSuggestions() {
export function renderVotes() {
const list = $("vote-list");
if (!list) return;
const prevScroll = list.scrollTop;
list.innerHTML = "";
const votesMap = Object.fromEntries(
state.myVotes.map((v) => [v.suggestionId, v.score]),
@@ -205,6 +206,7 @@ export function renderVotes() {
});
updatePhaseNav();
updateMissingBadgeFromDom();
list.scrollTop = prevScroll;
list.querySelectorAll("input[type=range]").forEach((input) => {
input.addEventListener("input", (e) => {
if (state.votesFinal) return;
@@ -734,6 +736,18 @@ export function openResultsRelockModal() {
});
}
export function openSuggestionsChangedModal(names) {
const uniq = Array.from(new Set(names)).filter(Boolean);
if (uniq.length === 0) return;
openConfirmModal({
title: t("vote.listUpdatedTitle"),
body: t("vote.listUpdatedBody", { names: uniq.join(", ") }),
confirmLabel: t("vote.listUpdatedConfirm"),
cancelLabel: null,
onConfirm: (close) => close(),
});
}
export function openConfirmModal({ title, body, confirmLabel, cancelLabel = t("modal.cancel"), onConfirm }) {
const overlay = document.createElement("div");
overlay.className = "edit-modal";