referenzen auf "credits" entfernt. Kamera-Seite schicker gemacht
This commit is contained in:
@@ -33,6 +33,7 @@ use Illuminate\Support\Facades\Cache;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\RateLimiter;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Facades\URL;
|
||||
use Illuminate\Support\Str;
|
||||
@@ -1618,6 +1619,10 @@ class EventPublicController extends BaseController
|
||||
$guestIdentifier = $this->resolveNotificationIdentifier($request);
|
||||
$limit = max(1, min(50, (int) $request->integer('limit', 35)));
|
||||
|
||||
if (! Schema::hasTable('guest_notifications')) {
|
||||
return $this->emptyNotificationsResponse($request, $event->id, 'disabled');
|
||||
}
|
||||
|
||||
$baseQuery = GuestNotification::query()
|
||||
->where('event_id', $event->id)
|
||||
->active()
|
||||
@@ -1668,6 +1673,30 @@ class EventPublicController extends BaseController
|
||||
->header('Vary', 'X-Device-Id, Accept-Language');
|
||||
}
|
||||
|
||||
private function emptyNotificationsResponse(Request $request, int $eventId, string $reason = 'empty'): JsonResponse
|
||||
{
|
||||
$etag = sha1(sprintf('event:%d:guest_notifications:%s', $eventId, $reason));
|
||||
|
||||
$clientEtags = array_map(fn ($tag) => trim($tag, '"'), $request->getETags());
|
||||
if (in_array($etag, $clientEtags, true)) {
|
||||
return response()->json([], Response::HTTP_NOT_MODIFIED)
|
||||
->header('ETag', $etag)
|
||||
->header('Cache-Control', 'no-store')
|
||||
->header('Vary', 'X-Device-Id, Accept-Language');
|
||||
}
|
||||
|
||||
return response()->json([
|
||||
'data' => [],
|
||||
'meta' => [
|
||||
'unread_count' => 0,
|
||||
'poll_after_seconds' => 120,
|
||||
'reason' => $reason,
|
||||
],
|
||||
])->header('ETag', $etag)
|
||||
->header('Cache-Control', 'no-store')
|
||||
->header('Vary', 'X-Device-Id, Accept-Language');
|
||||
}
|
||||
|
||||
public function registerPushSubscription(Request $request, string $token)
|
||||
{
|
||||
$result = $this->resolvePublishedEvent($request, $token, ['id']);
|
||||
|
||||
Reference in New Issue
Block a user