Fix template variable docs to match actual notifier output
All checks were successful
Validate / Hassfest (push) Successful in 3s
All checks were successful
Validate / Hassfest (push) Successful in 3s
Audit and fix all template variable references: - template_vars.py: Add missing fields (album_id, old_shared, new_shared, latitude, longitude, owner_id, people per asset) - _SAMPLE_CONTEXT: Use proper structured data matching build_asset_detail() output (id, owner_id, latitude, longitude, people per asset, playback_url for videos) - i18n: Fix all variable descriptions for accuracy, add missing fields, mark scheduler-dependent slots as "not yet implemented" - Variables modal: Add album_fields section for periodic_summary - Shared _ASSET_FIELDS and _ALBUM_FIELDS dicts in template_vars.py to keep scheduled/memory slots DRY Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -14,22 +14,37 @@ from ..database.models import TemplateConfig, User
|
||||
|
||||
router = APIRouter(prefix="/api/template-configs", tags=["template-configs"])
|
||||
|
||||
# Sample asset for template preview
|
||||
# Sample asset matching what build_asset_detail() actually returns
|
||||
_SAMPLE_ASSET = {
|
||||
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
|
||||
"filename": "IMG_001.jpg",
|
||||
"type": "IMAGE",
|
||||
"created_at": "2026-03-19T10:30:00",
|
||||
"owner": "Alice",
|
||||
"owner_id": "user-uuid-1",
|
||||
"description": "Family picnic",
|
||||
"url": "https://immich.example.com/photos/abc123",
|
||||
"download_url": "https://immich.example.com/api/assets/abc123/original",
|
||||
"photo_url": "https://immich.example.com/api/assets/abc123/thumbnail",
|
||||
"playback_url": "",
|
||||
"people": ["Alice", "Bob"],
|
||||
"is_favorite": True,
|
||||
"rating": 5,
|
||||
"latitude": 48.8566,
|
||||
"longitude": 2.3522,
|
||||
"city": "Paris",
|
||||
"state": "Île-de-France",
|
||||
"country": "France",
|
||||
"url": "https://immich.example.com/photos/abc123",
|
||||
"download_url": "https://immich.example.com/api/assets/abc123/original",
|
||||
"photo_url": "https://immich.example.com/api/assets/abc123/thumbnail",
|
||||
}
|
||||
|
||||
_SAMPLE_VIDEO_ASSET = {
|
||||
**_SAMPLE_ASSET,
|
||||
"id": "d4e5f6a7-b8c9-0123-defg-456789abcdef",
|
||||
"filename": "VID_002.mp4",
|
||||
"type": "VIDEO",
|
||||
"is_favorite": False,
|
||||
"rating": None,
|
||||
"photo_url": None,
|
||||
"playback_url": "https://immich.example.com/api/assets/def456/video",
|
||||
}
|
||||
|
||||
_SAMPLE_ALBUM = {
|
||||
@@ -39,23 +54,26 @@ _SAMPLE_ALBUM = {
|
||||
"shared": True,
|
||||
}
|
||||
|
||||
# Full context covering all possible template variables
|
||||
# Full context covering ALL possible template variables from _build_event_data()
|
||||
_SAMPLE_CONTEXT = {
|
||||
# Event variables
|
||||
# Core event fields (always present)
|
||||
"album_id": "b2eeeaa4-bba0-477a-a06f-5cb9e21818e8",
|
||||
"album_name": "Family Photos",
|
||||
"album_url": "https://immich.example.com/share/abc123",
|
||||
"change_type": "assets_added",
|
||||
"added_count": 3,
|
||||
"removed_count": 1,
|
||||
"change_type": "assets_added",
|
||||
"people": ["Alice", "Bob"],
|
||||
"added_assets": [_SAMPLE_ASSET, {**_SAMPLE_ASSET, "filename": "VID_002.mp4", "type": "VIDEO", "is_favorite": False, "rating": None, "playback_url": "https://immich.example.com/api/assets/def456/video"}],
|
||||
"added_assets": [_SAMPLE_ASSET, _SAMPLE_VIDEO_ASSET],
|
||||
"removed_assets": ["asset-id-1", "asset-id-2"],
|
||||
"people": ["Alice", "Bob"],
|
||||
"shared": True,
|
||||
"video_warning": "\n\n⚠️ Note: Videos may not be sent due to Telegram's 50 MB file size limit.",
|
||||
# Rename variables
|
||||
# Rename fields (always present, empty for non-rename events)
|
||||
"old_name": "Old Album",
|
||||
"new_name": "New Album",
|
||||
# Scheduled/periodic variables
|
||||
"old_shared": False,
|
||||
"new_shared": True,
|
||||
# Scheduled/periodic variables (for those templates)
|
||||
"albums": [_SAMPLE_ALBUM, {**_SAMPLE_ALBUM, "name": "Vacation 2025", "asset_count": 120}],
|
||||
"assets": [_SAMPLE_ASSET, {**_SAMPLE_ASSET, "filename": "IMG_002.jpg", "city": "London", "country": "UK"}],
|
||||
"date": "2026-03-19",
|
||||
|
||||
Reference in New Issue
Block a user