Add emotion data and lightbox share/download
Some checks failed
linter / quality (push) Has been cancelled
tests / ci (push) Has been cancelled
tests / ui (push) Has been cancelled

This commit is contained in:
Codex Agent
2026-02-05 20:35:11 +01:00
parent ba56cb4e61
commit c6aaf859f5
6 changed files with 657 additions and 295 deletions

View File

@@ -2854,6 +2854,7 @@ class EventPublicController extends BaseController
$since = $request->query('since');
$query = DB::table('photos')
->leftJoin('tasks', 'photos.task_id', '=', 'tasks.id')
->leftJoin('emotions', 'photos.emotion_id', '=', 'emotions.id')
->select([
'photos.id',
'photos.file_path',
@@ -2865,6 +2866,10 @@ class EventPublicController extends BaseController
'photos.created_at',
'photos.ingest_source',
'tasks.title as task_title',
'emotions.name as emotion_name',
'emotions.icon as emotion_icon',
'emotions.color as emotion_color',
'emotions.id as emotion_lookup_id',
])
->where('photos.event_id', $eventId)
->where('photos.status', 'approved')
@@ -2892,6 +2897,20 @@ class EventPublicController extends BaseController
$r->task_title = $this->firstLocalizedValue($r->task_title, $fallbacks, 'Unbenannte Aufgabe');
}
$emotion = null;
if ($r->emotion_id) {
$emotionName = $this->firstLocalizedValue($r->emotion_name, $fallbacks, '');
if ($emotionName !== '') {
$emotion = [
'id' => (int) ($r->emotion_lookup_id ?? $r->emotion_id),
'name' => $emotionName,
'icon' => $r->emotion_icon ?: null,
'color' => $r->emotion_color ?: null,
];
}
}
$r->emotion = $emotion;
$r->ingest_source = $r->ingest_source ?? Photo::SOURCE_UNKNOWN;
return $r;