🛡️ Warracker is an open source, self-hostable warranty tracker to monitor expirations, store receipts, files. You own the data, your rules!
Use trash icon for team note deletion
Omega (QA)318accc23862
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 25c45fd..70362d5 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -23,8 +23,8 @@- _Files: `Dockerfile`_- **CI workflow pinning and Renovate action update (#279, #282):** pinned `actions/checkout`, `actions/setup-python`, the CI `postgres:15` service image, and Python version in the test and Docker workflows by commit SHA/digest for supply-chain safety, and updated `renovatebot/github-action` from v46.3.10 to v46.3.14.- _Files: `.github/workflows/tests.yml`, `.github/workflows/docker-build.yml`, `.github/workflows/renovate.yml`_-- **Team notes on warranties:** anyone who can view a warranty can now add a note to it, and each entry shows the username of the person who added it and the time it was added. Entries live in a new table, so the warranty's own notes field is untouched and stays editable only by the owner or an admin. An entry can be deleted by its author, the warranty owner, or an admin. With global view off, or restricted to admins, non-owners can neither view nor add entries.- - _Files: `backend/migrations/056_create_warranty_note_entries.sql`, `backend/warranties_routes.py`, `frontend/js/components/notes.js`, `frontend/script.js`, `tests/test_warranty_note_entries.py`, `tests/test_status_edit_and_notes.py`_+- **Team notes on warranties:** anyone who can view a warranty can now add a note to it, and each entry shows the username of the person who added it and the time it was added. Entries live in a new table, so the warranty's own notes field is untouched and stays editable only by the owner or an admin. An entry can be deleted by its author, the warranty owner, or an admin, using the trash icon beside the entry. With global view off, or restricted to admins, non-owners can neither view nor add entries.+ - _Files: `backend/migrations/056_create_warranty_note_entries.sql`, `backend/warranties_routes.py`, `frontend/js/components/notes.js`, `frontend/script.js`, `frontend/style.css`, `tests/test_warranty_note_entries.py`, `tests/test_status_edit_and_notes.py`_## 1.0.7 - 2026-11-23diff --git a/frontend/js/components/notes.js b/frontend/js/components/notes.jsindex d131d38..322bad6 100644--- a/frontend/js/components/notes.js+++ b/frontend/js/components/notes.js@@ -301,23 +301,29 @@ function renderNoteEntries(entries) {for (const entry of entries) {const row = document.createElement('div');row.className = 'note-entry';- row.style.cssText = 'border-top: 1px solid var(--border-color, #ddd); padding: 8px 0;';+ const content = document.createElement('div');+ content.className = 'note-entry-content';const meta = document.createElement('div');meta.className = 'note-entry-meta';- meta.style.cssText = 'font-size: 0.85em; color: var(--text-muted, #666);';const when = entry.created_at ? new Date(entry.created_at).toLocaleString() : '';meta.textContent = entry.username + ' - ' + when;const text = document.createElement('div');text.className = 'note-entry-text';- text.style.whiteSpace = 'pre-line';text.textContent = entry.text;- row.appendChild(meta);- row.appendChild(text);+ content.appendChild(meta);+ content.appendChild(text);+ row.appendChild(content);if (canDeleteNoteEntry(entry)) {const del = document.createElement('button');del.type = 'button';- del.className = 'btn btn-sm btn-danger note-entry-delete';- del.textContent = 'Delete';+ del.className = 'note-entry-delete';+ const deleteLabel = entry.username ? `Delete note by ${entry.username}` : 'Delete note';+ del.setAttribute('aria-label', deleteLabel);+ del.title = 'Delete note';+ const icon = document.createElement('i');+ icon.className = 'fas fa-trash';+ icon.setAttribute('aria-hidden', 'true');+ del.appendChild(icon);del.addEventListener('click', () => deleteNoteEntry(entry.id));row.appendChild(del);}diff --git a/frontend/style.css b/frontend/style.cssindex 1619531..4ac2d99 100644--- a/frontend/style.css+++ b/frontend/style.css@@ -1213,6 +1213,66 @@ input.invalid {flex-grow: 1; /* Allow body to take available space */background-color: var(--card-bg); /* Ensure background */}++/* Team note entries in the notes modal */+.note-entry {+ display: flex;+ align-items: flex-start;+ gap: 12px;+ border-top: 1px solid var(--border-color, #ddd);+ padding: 10px 0;+}++.note-entry-content {+ flex: 1 1 auto;+ min-width: 0;+}++.note-entry-meta {+ font-size: 0.85em;+ color: var(--text-muted, #666);+ margin-bottom: 2px;+ overflow-wrap: anywhere;+}++.note-entry-text {+ white-space: pre-line;+ overflow-wrap: anywhere;+}++.note-entry-delete {+ flex: 0 0 auto;+ width: 40px;+ height: 40px;+ margin-inline-start: auto;+ display: inline-flex;+ align-items: center;+ justify-content: center;+ border: 1px solid transparent;+ border-radius: 8px;+ background: transparent;+ color: var(--text-muted, #666);+ cursor: pointer;+ transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;+}++.note-entry-delete:hover {+ color: var(--danger-color, #c0392b);+ background-color: rgba(231, 76, 60, 0.08);+ border-color: rgba(231, 76, 60, 0.18);+}++.note-entry-delete:focus-visible {+ color: var(--danger-color, #c0392b);+ background-color: rgba(231, 76, 60, 0.08);+ outline: 2px solid var(--danger-color, #c0392b);+ outline-offset: 2px;+}++.note-entry-delete i {+ font-size: 1rem;+ line-height: 1;+}/* Mobile-friendly layout for Manage Tags */@media (max-width: 600px) {#tagManagementModal .modal {diff --git a/tests/test_status_edit_and_notes.py b/tests/test_status_edit_and_notes.pyindex 60283a1..0d2c29d 100644--- a/tests/test_status_edit_and_notes.py+++ b/tests/test_status_edit_and_notes.py@@ -81,7 +81,17 @@ def test_notes_modal_renders_team_entry_thread():assert "new Date(entry.created_at).toLocaleString()" in notesassert "meta.textContent = entry.username + ' - ' + when" in notesassert "text.textContent = entry.text" in notes+ assert "del.className = 'note-entry-delete'" in notes+ assert "del.setAttribute('aria-label', deleteLabel)" in notes+ assert "icon.className = 'fas fa-trash'" in notes+ assert "btn-danger note-entry-delete" not in notesassert "refs.editBtn.disabled = !canEdit" in notes+ css = (REPO / "frontend" / "style.css").read_text()+ assert ".note-entry {" in css+ assert "display: flex;" in css+ assert ".note-entry-delete {" in css+ assert "width: 40px;" in css+ assert "height: 40px;" in css# The live modal markup is the legacy one script.js injects at load# time; the module reuses it when it exists. It must carry the same# thread and add-box elements, or the modal opens without them.