Add emotion data and lightbox share/download
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user