From 5a232f18b86ac97f02821ee6ac5ea89ee7415212 Mon Sep 17 00:00:00 2001 From: "alexei.dolgolyov" Date: Wed, 22 Apr 2026 03:28:05 +0300 Subject: [PATCH] feat(commands): drop tracker counts from /status MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit trackers_active / trackers_total are per-provider aggregates — once the rest of /status is scoped to the chat's album set (total_albums and last_event both filtered by the derived scope), leaving tracker counts in would leak info about trackers this chat has no visibility into. - _cmd_status no longer emits trackers_active / trackers_total. - Immich default status templates (en, ru) just show Albums + Last event. - Variable catalog updated so the template editor stops suggesting the removed vars for the Immich /status slot. --- .../templates/command_defaults/en/status.jinja2 | 3 +-- .../templates/command_defaults/ru/status.jinja2 | 3 +-- .../notify_bridge_server/api/command_template_configs.py | 8 +++----- .../src/notify_bridge_server/commands/immich/handler.py | 8 +++++--- 4 files changed, 10 insertions(+), 12 deletions(-) diff --git a/packages/core/src/notify_bridge_core/templates/command_defaults/en/status.jinja2 b/packages/core/src/notify_bridge_core/templates/command_defaults/en/status.jinja2 index 49edad2..b15d31c 100644 --- a/packages/core/src/notify_bridge_core/templates/command_defaults/en/status.jinja2 +++ b/packages/core/src/notify_bridge_core/templates/command_defaults/en/status.jinja2 @@ -1,4 +1,3 @@ 📊 Status -Trackers: {{ trackers_active }}/{{ trackers_total }} active Albums: {{ total_albums }} -Last event: {{ last_event }} \ No newline at end of file +Last event: {{ last_event }} diff --git a/packages/core/src/notify_bridge_core/templates/command_defaults/ru/status.jinja2 b/packages/core/src/notify_bridge_core/templates/command_defaults/ru/status.jinja2 index 05fff82..873a20b 100644 --- a/packages/core/src/notify_bridge_core/templates/command_defaults/ru/status.jinja2 +++ b/packages/core/src/notify_bridge_core/templates/command_defaults/ru/status.jinja2 @@ -1,4 +1,3 @@ 📊 Статус -Трекеры: {{ trackers_active }}/{{ trackers_total }} активных Альбомы: {{ total_albums }} -Последнее событие: {{ last_event }} \ No newline at end of file +Последнее событие: {{ last_event }} diff --git a/packages/server/src/notify_bridge_server/api/command_template_configs.py b/packages/server/src/notify_bridge_server/api/command_template_configs.py index 0a3a78f..5e1f64d 100644 --- a/packages/server/src/notify_bridge_server/api/command_template_configs.py +++ b/packages/server/src/notify_bridge_server/api/command_template_configs.py @@ -138,13 +138,11 @@ async def get_command_variables( # --- Immich-specific --- immich = { "status": { - "description": "/status tracker summary", + "description": "/status tracker summary (scoped to this chat)", "variables": { **common_vars, - "trackers_active": "Number of active trackers", - "trackers_total": "Total tracker count", - "total_albums": "Total tracked albums", - "last_event": "Last event timestamp string", + "total_albums": "Tracked albums visible to this chat", + "last_event": "Last event timestamp string (scoped to this chat's albums)", }, }, "albums": { diff --git a/packages/server/src/notify_bridge_server/commands/immich/handler.py b/packages/server/src/notify_bridge_server/commands/immich/handler.py index dfb246e..6724474 100644 --- a/packages/server/src/notify_bridge_server/commands/immich/handler.py +++ b/packages/server/src/notify_bridge_server/commands/immich/handler.py @@ -29,8 +29,6 @@ async def _cmd_status( allowed_album_ids: set[str] | None = None, ) -> dict[str, Any]: trackers = await get_trackers_for_provider(provider.id) - active = sum(1 for t in trackers if t.enabled) - total = len(trackers) # Count only albums visible to this chat. Without the scope filter, # /status in a restricted chat leaks the full album count across the @@ -41,13 +39,17 @@ async def _cmd_status( if allowed_album_ids is None or aid in allowed_album_ids: total_albums += 1 + # Last-event timestamp is already scoped — see get_last_event_str, which + # filters EventLog by collection_id against allowed_album_ids. tracker_ids = [t.id for t in trackers] last_str = await get_last_event_str( tracker_ids, allowed_album_ids=allowed_album_ids, ) + # Tracker counts (``trackers_active`` / ``trackers_total``) are a + # per-provider aggregate — they'd leak info about trackers this chat + # has no visibility into once we've scoped everything else. Omitted. return { - "trackers_active": active, "trackers_total": total, "total_albums": total_albums, "last_event": last_str, }