Show post authors and action buttons
This commit is contained in:
@@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
## 2026-01-11
|
## 2026-01-11
|
||||||
- Restyled the thread view to mimic phpBB: compact toolbar, title row, and post layout.
|
- Restyled the thread view to mimic phpBB: compact toolbar, title row, and post layout.
|
||||||
|
- Added phpBB-style post action buttons and post author info for replies.
|
||||||
|
|
||||||
## 2025-12-30
|
## 2025-12-30
|
||||||
- Added soft deletes with audit metadata (deleted_at/deleted_by) for forums, threads, and posts.
|
- Added soft deletes with audit metadata (deleted_at/deleted_by) for forums, threads, and posts.
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ class PostController extends Controller
|
|||||||
{
|
{
|
||||||
public function index(Request $request): JsonResponse
|
public function index(Request $request): JsonResponse
|
||||||
{
|
{
|
||||||
$query = Post::query()->withoutTrashed();
|
$query = Post::query()->withoutTrashed()->with('user');
|
||||||
|
|
||||||
$threadParam = $request->query('thread');
|
$threadParam = $request->query('thread');
|
||||||
if (is_string($threadParam)) {
|
if (is_string($threadParam)) {
|
||||||
@@ -45,6 +45,8 @@ class PostController extends Controller
|
|||||||
'body' => $data['body'],
|
'body' => $data['body'],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
$post->loadMissing('user');
|
||||||
|
|
||||||
return response()->json($this->serializePost($post), 201);
|
return response()->json($this->serializePost($post), 201);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -81,6 +83,7 @@ class PostController extends Controller
|
|||||||
'body' => $post->body,
|
'body' => $post->body,
|
||||||
'thread' => "/api/threads/{$post->thread_id}",
|
'thread' => "/api/threads/{$post->thread_id}",
|
||||||
'user_id' => $post->user_id,
|
'user_id' => $post->user_id,
|
||||||
|
'user_name' => $post->user?->name,
|
||||||
'created_at' => $post->created_at?->toIso8601String(),
|
'created_at' => $post->created_at?->toIso8601String(),
|
||||||
'updated_at' => $post->updated_at?->toIso8601String(),
|
'updated_at' => $post->updated_at?->toIso8601String(),
|
||||||
];
|
];
|
||||||
|
|||||||
4
artisan
4
artisan
@@ -4,7 +4,7 @@
|
|||||||
use Illuminate\Foundation\Application;
|
use Illuminate\Foundation\Application;
|
||||||
use Symfony\Component\Console\Input\ArgvInput;
|
use Symfony\Component\Console\Input\ArgvInput;
|
||||||
|
|
||||||
define('LARAVEL_START', microtime(true));
|
define(constant_name: 'LARAVEL_START', value: microtime(as_float: true));
|
||||||
|
|
||||||
// Register the Composer autoloader...
|
// Register the Composer autoloader...
|
||||||
require __DIR__.'/vendor/autoload.php';
|
require __DIR__.'/vendor/autoload.php';
|
||||||
@@ -13,6 +13,6 @@ require __DIR__.'/vendor/autoload.php';
|
|||||||
/** @var Application $app */
|
/** @var Application $app */
|
||||||
$app = require_once __DIR__.'/bootstrap/app.php';
|
$app = require_once __DIR__.'/bootstrap/app.php';
|
||||||
|
|
||||||
$status = $app->handleCommand(new ArgvInput);
|
$status = $app->handleCommand(input: new ArgvInput);
|
||||||
|
|
||||||
exit($status);
|
exit($status);
|
||||||
|
|||||||
@@ -252,6 +252,38 @@ a {
|
|||||||
margin-bottom: 0.75rem;
|
margin-bottom: 0.75rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.bb-post-header-meta {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.6rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bb-post-actions {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.35rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bb-post-action {
|
||||||
|
width: 44px;
|
||||||
|
height: 44px;
|
||||||
|
border-radius: 6px;
|
||||||
|
border: 1px solid #2a2f3a;
|
||||||
|
background: #20252f;
|
||||||
|
color: #c7cdd7;
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
font-size: 1.3rem;
|
||||||
|
transition: border-color 0.15s ease, color 0.15s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.bb-post-action:hover {
|
||||||
|
color: var(--bb-accent, #f29b3f);
|
||||||
|
border-color: var(--bb-accent, #f29b3f);
|
||||||
|
}
|
||||||
|
|
||||||
.bb-post-body {
|
.bb-post-body {
|
||||||
white-space: pre-wrap;
|
white-space: pre-wrap;
|
||||||
color: var(--bb-ink);
|
color: var(--bb-ink);
|
||||||
|
|||||||
@@ -125,10 +125,29 @@ export default function ThreadView() {
|
|||||||
</aside>
|
</aside>
|
||||||
<div className="bb-post-content">
|
<div className="bb-post-content">
|
||||||
<div className="bb-post-header">
|
<div className="bb-post-header">
|
||||||
<span>{t('thread.by')} {authorName}</span>
|
<div className="bb-post-header-meta">
|
||||||
{post.created_at && (
|
<span>{t('thread.by')} {authorName}</span>
|
||||||
<span>{post.created_at.slice(0, 10)}</span>
|
{post.created_at && (
|
||||||
)}
|
<span>{post.created_at.slice(0, 10)}</span>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
<div className="bb-post-actions">
|
||||||
|
<button type="button" className="bb-post-action" aria-label="Edit post">
|
||||||
|
<i className="bi bi-pencil" aria-hidden="true" />
|
||||||
|
</button>
|
||||||
|
<button type="button" className="bb-post-action" aria-label="Delete post">
|
||||||
|
<i className="bi bi-x-lg" aria-hidden="true" />
|
||||||
|
</button>
|
||||||
|
<button type="button" className="bb-post-action" aria-label="Report post">
|
||||||
|
<i className="bi bi-exclamation-lg" aria-hidden="true" />
|
||||||
|
</button>
|
||||||
|
<button type="button" className="bb-post-action" aria-label="Post info">
|
||||||
|
<i className="bi bi-info-lg" aria-hidden="true" />
|
||||||
|
</button>
|
||||||
|
<button type="button" className="bb-post-action" aria-label="Quote post">
|
||||||
|
<i className="bi bi-quote" aria-hidden="true" />
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="bb-post-body">{post.body}</div>
|
<div className="bb-post-body">{post.body}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user