feat: Implement chat pagination, participant single page with mutations, and fix user link substitutions

This commit is contained in:
Daan Meijer
2026-06-17 22:55:11 +02:00
parent 11df4ef55c
commit ed16d5dcda
12 changed files with 268 additions and 43 deletions
+9 -11
View File
@@ -52,17 +52,7 @@ class DynamicController extends Controller
$activityService->updateCursor($request->user(), $dynamic);
$dynamic->load([
'ledgers.media',
'participants' => fn($query) => $query->withPivot('display_name'),
'chat.messages.user',
'chat.messages.media',
'chat.messages.subject' => function ($morphTo) {
$morphTo->morphWith([
\App\Models\Mutation::class => ['ledger'],
]);
}
]);
$dynamic->load(['ledgers.media', 'participants', 'chat']);
$isOwner = $dynamic->participants()
->where('user_id', $request->user()->id)
@@ -72,9 +62,17 @@ class DynamicController extends Controller
return Inertia::render('Dynamics/Show', [
'dynamic' => $dynamic,
'isOwner' => $isOwner,
'messages' => $dynamic->chat->messages()->with(['user', 'media'])->latest()->paginate(20),
]);
}
public function messages(Request $request, Dynamic $dynamic)
{
$this->authorize('view', $dynamic);
return $dynamic->chat->messages()->with(['user', 'media'])->latest()->paginate(20);
}
/**
* Show the form for editing the specified resource.
*/