UI: portal/header refinements, board index UX, and user settings

This commit is contained in:
Micha
2026-01-01 19:54:02 +01:00
parent f83748cc76
commit 8604cdf95d
26 changed files with 2065 additions and 227 deletions

View File

@@ -11,7 +11,7 @@ class ThreadController extends Controller
{
public function index(Request $request): JsonResponse
{
$query = Thread::query();
$query = Thread::query()->withoutTrashed()->with('user');
$forumParam = $request->query('forum');
if (is_string($forumParam)) {
@@ -31,6 +31,7 @@ class ThreadController extends Controller
public function show(Thread $thread): JsonResponse
{
$thread->loadMissing('user');
return response()->json($this->serializeThread($thread));
}
@@ -59,8 +60,10 @@ class ThreadController extends Controller
return response()->json($this->serializeThread($thread), 201);
}
public function destroy(Thread $thread): JsonResponse
public function destroy(Request $request, Thread $thread): JsonResponse
{
$thread->deleted_by = $request->user()?->id;
$thread->save();
$thread->delete();
return response()->json(null, 204);
@@ -91,6 +94,7 @@ class ThreadController extends Controller
'body' => $thread->body,
'forum' => "/api/forums/{$thread->forum_id}",
'user_id' => $thread->user_id,
'user_name' => $thread->user?->name,
'created_at' => $thread->created_at?->toIso8601String(),
'updated_at' => $thread->updated_at?->toIso8601String(),
];