Files
notify-bridge/plans/ux-notification-improvements/phase-6-no-link-support.md
T
alexei.dolgolyov 03c5c66eed feat: UX & notification improvements — icons, events, chat names, link validation, templates
- Show entity icons on all cards with fallback defaults (providers, trackers, targets, bots)
- Enrich EventLog with provider_name, tracker_name, assets_count; add DB migration
- Dashboard events: filtering (type, provider, search), sorting, pagination, dynamic page size
- Friendly chat names on telegram target cards (resolve from TelegramChat table)
- Test message button on bot chat items with locale-aware messages
- Album public link validation on tracker save with auto-create dialog
- Support albums without public links: conditional <a href> in templates
- Fetch shared links during poll, enrich events with public_url/protected_url
- Per-asset public_url in template context ({share_url}/photos/{asset_id})
- Common date/location detection: common_date + common_location context vars
- Dual date formats: date_format (datetime) + date_only_format (date only)
- Template clone button, HTML link rendering in template preview
- Fix Telegram asset download 401: pass x-api-key headers through client
- Fix provider external_url matching for API key scoping
- Fix event timestamp timezone (append Z suffix for UTC)
- Localize event filter controls, test messages (EN/RU)
- Template variable UI helpers updated with all new fields
- CLAUDE.md: template system sync rules documentation

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 16:18:03 +03:00

48 lines
2.8 KiB
Markdown

# Phase 6: Support Albums Without Public Links
**Status:** ⬜ Not Started
**Parent plan:** [PLAN.md](./PLAN.md)
**Domain:** backend
## Objective
Allow tracking albums even without public links. Templates should conditionally wrap items in `<a href>` when public URLs exist, otherwise show plain text names. Telegram should still send assets to chats regardless of public link status.
## Tasks
- [ ] Task 1: In template context building (context.py), include `has_public_url` / `album_url` / per-asset `public_url` flags so templates can conditionally render links
- [ ] Task 2: Update default system templates (EN/RU seeds) to use `{% if album_url %}` / `{% if asset.public_url %}` conditionals — wrap in `<a href>` when URL exists, plain text otherwise
- [ ] Task 3: Verify that Telegram notification sending (notifier.py + telegram client) sends assets via direct API download regardless of public link status (it should already work since it uses internal API URLs with api_key headers, not public links)
- [ ] Task 4: Ensure the template context correctly distinguishes between internal API URLs (for media download) and public URLs (for user-facing links in messages)
- [ ] Task 5: Test that events from albums without public links still generate notifications with asset media but no clickable links in the message text
## Files to Modify/Create
- `packages/core/src/notify_bridge_core/templates/context.py` — add public_url flags to context
- `packages/core/src/notify_bridge_core/providers/immich/provider.py` — ensure shared link info flows through events
- `packages/server/src/notify_bridge_server/services/notifier.py` — verify asset sending works without public links
- Default template seeds (wherever EN/RU templates are defined) — conditional link rendering
## Acceptance Criteria
- Albums without public links can be tracked without errors
- Notifications are sent with media assets regardless of public link status
- Message text includes clickable links only when public URLs exist
- Message text shows plain album/asset names when no public URL
- Default EN/RU templates handle both cases
- No regressions for albums that DO have public links
## Notes
- Internal asset URLs use format: `{provider_url}/api/assets/{id}/original` with x-api-key header
- Public URLs use format: `{external_domain}/share/{key}` (no auth needed)
- Telegram client downloads via internal URLs (with headers) — this is independent of public links
- The public URL is only relevant for the message text (human-readable links)
- Template context already has `album_url` from event.extra — need to make it None/empty when no shared link
## Review Checklist
- [ ] All tasks completed
- [ ] Code follows project conventions
- [ ] No unintended side effects
- [ ] Build passes
- [ ] Tests pass (new + existing)
## Handoff to Next Phase
<!-- Filled in after completion -->