From ae0c7485072c7f150222cbddf6da33ebd7d84703 Mon Sep 17 00:00:00 2001 From: Bryan Van Deusen Date: Wed, 22 Jul 2026 12:36:50 -0400 Subject: [PATCH] =?UTF-8?q?M6:=20label=20management=20=E2=80=94=20usage=20?= =?UTF-8?q?counts=20+=20merge?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Extends the existing label manager (create/rename/color/delete) with the two missing maintenance tools (task 1904), so the label list stays clean — which matters more now that #tags mint labels automatically. Backend: GET /api/labels returns a per-label note count (one grouped query); new POST /api/labels//merge moves the source label's notes onto a target and deletes the source (repoint via delete+reinsert to avoid mutating the composite PK; preserves via_tag; dedupes notes already on the target). Body #tags are NOT rewritten, so a tag-sourced label re-mints on next edit if its #tag text remains — a documented nuance. Frontend: LabelsModal shows each label's note count and a 'merge into…' picker; also restores the previously-missing close (x) and merge icons. Co-Authored-By: Claude Opus 4.8 (1M context) Claude-Session: https://claude.ai/code/session_01FRgehjoz7Yv8LkUfADxACm --- frontend/src/components/Icon.vue | 2 + frontend/src/components/LabelsModal.vue | 72 ++++++++++++++++++++++--- frontend/src/stores/labels.ts | 19 +++++-- src/thoughtsync/labels.py | 71 +++++++++++++++++++++--- tests/test_labels.py | 9 ++++ 5 files changed, 158 insertions(+), 15 deletions(-) diff --git a/frontend/src/components/Icon.vue b/frontend/src/components/Icon.vue index c2d6065..a30f409 100644 --- a/frontend/src/components/Icon.vue +++ b/frontend/src/components/Icon.vue @@ -20,6 +20,8 @@ const paths: Record = { bell: '', grip: '', calendar: '', + close: '', + merge: '', }; diff --git a/frontend/src/components/LabelsModal.vue b/frontend/src/components/LabelsModal.vue index 1233247..4f96c96 100644 --- a/frontend/src/components/LabelsModal.vue +++ b/frontend/src/components/LabelsModal.vue @@ -1,6 +1,6 @@