feat: Implement chat pagination, participant single page with mutations, and fix user link substitutions
This commit is contained in:
@@ -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.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user