history.js: the name comes from the snapshot, and cite the sections that exist

This commit is contained in:
ai-bot committed 2026-10-28 18:08:24 +00:00
1 parent ec011615c7
commit 174c4ee421
1 file changed
+15 -15
+15 -15
View File
@@ -6,7 +6,7 @@ const detailTitle = document.querySelector("#history-detail-title");
const detailBody = document.querySelector("#history-detail-body");
const requestedId = new URLSearchParams(window.location.search).get("id");
// The readable wording of every action that closes an alert (section 26.4). The
// The readable wording of every action that closes an alert (section 26). The
// dashboard and the form carry the same map, and it is duplicated here on
// purpose, so the history can show the action that was carried out
// (section 27).
@@ -104,8 +104,9 @@ function card(title, content) {
}
function keyLabel(record) {
// The key name is read from the key row, so a saved check shows the name the
// key has now, which the settings may change (section 25.2).
// The name is read from the snapshot on the check, not from the key row, so a
// rename or a rotation cannot change what an older record says (sections 9
// and 32.8).
const labels = (record.key_checks || []).map(
(entry) => `Key ${entry.key_number}: ${entry.name}`,
);
@@ -124,7 +125,7 @@ function summaryEntries(record) {
["Software compatibility", record.software_compatibility_status],
["Software notes", record.software_comments],
// The contact confirmation is a stored status, so it is shown as text
// (section 23.1).
// (section 23).
["Contact details confirmed", record.contact_info_verified],
["Comments", record.comments],
];
@@ -151,7 +152,7 @@ function keyEntries(keyCheck) {
entries.push(["Seed backup verified", keyCheck.seed_backup_verified]);
}
// The user records the address path only; the verification result is derived
// by the server, so it is shown as a derived value (sections 9 and 25.1).
// by the server, so it is shown as a derived value (sections 9 and 25).
entries.push(["Address path", keyCheck.address_path]);
entries.push(["Address path verified (derived)", keyCheck.address_path_verified]);
entries.push(["Comments", keyCheck.comments]);
@@ -172,8 +173,7 @@ function closedAlertsTable(closedAlerts) {
// Every closure of the check is shown with the source of the alert it closed,
// the code, the action written out as a readable label, and the date
// (section 27). The source is what tells the key form and the software form
// of the same code apart, so it has a column of its own (section 32.9
// point 1).
// of the same code apart, so it has a column of its own (section 32.9).
if (!closedAlerts.length) {
return emptyNote("No follow-up was closed on this check.");
}
@@ -192,7 +192,7 @@ function revealDetail() {
// The detail section is hidden until a check is opened, and a hidden element
// has no box, so the browser cannot jump to #history-detail on its own. The
// section is revealed first and the page moves to it afterwards
// (section 32.7 follow-up point 3).
// (section 32.7).
detailSection.hidden = false;
detailSection.scrollIntoView({ behavior: "smooth", block: "start" });
}
@@ -218,8 +218,9 @@ function renderDetail(record) {
}
function keyNamesText(check) {
// The card names the key by its number and the name it has now, which the
// settings may change (sections 25.2 and 32.2 point 14).
// The card names the key by its number and the name the check was recorded
// with, read from the snapshot, so a rename or a rotation cannot change what
// an older record says (sections 32.2 and 32.8).
const numbers = check.key_numbers || [];
const names = check.key_names || [];
if (!numbers.length) {
@@ -233,9 +234,9 @@ function keyNamesText(check) {
function followUpText(check) {
// The card reports the state of the check as it stands now, in three steps:
// nothing was raised, something is still open, or everything that was raised
// is closed (section 32.9 point 2). needs_follow_up is frozen at save time,
// while follow_up_open follows the merged, unacknowledged alerts the
// dashboard shows, so an alert a newer check re-raised is the newer check's.
// is closed (section 32.9). needs_follow_up is frozen at save time, while
// follow_up_open follows the merged, unacknowledged alerts the dashboard
// shows, so an alert a newer check re-raised is the newer check's.
if (!check.needs_follow_up) {
return "All OK";
}
@@ -266,8 +267,7 @@ function renderList(checks) {
text.append(heading, meta);
// The link carries the anchor of the detail section, so the browser lands on
// the check that was opened and not at the top of the page
// (section 32.7 follow-up point 3).
// the check that was opened and not at the top of the page (section 32.7).
const link = document.createElement("a");
link.className = "secondary-button";
link.href = `/history?id=${check.id}#history-detail`;