ycxc
All checks were successful
Deploy / deploy (push) Successful in 51s

This commit is contained in:
2026-07-24 21:00:47 +02:00
parent d507ae7bc7
commit 5256dd4080
14 changed files with 471 additions and 19 deletions

View File

@@ -150,9 +150,12 @@ final class Community
$where = $conditions ? ('AND ' . implode(' AND ', $conditions)) : '';
$avatarSelect = $this->hasColumn('user_profiles', 'avatar_skin_tone')
? ', ' . Avatar::selectColumns('p')
: '';
$sql = "SELECT ft.id, ft.title, ft.body, ft.created_at, ft.updated_at,
u.id as uid, u.created_at as user_created,
p.display_name,
p.display_name$avatarSelect,
$boardSelect,
(SELECT COUNT(*) FROM forum_posts fp WHERE fp.thread_id = ft.id) AS answers,
COALESCE(
@@ -203,6 +206,9 @@ final class Community
public function getThread(int $id): ?array
{
$select = 'ft.*, p.display_name';
if ($this->hasColumn('user_profiles', 'avatar_skin_tone')) {
$select .= ', ' . Avatar::selectColumns('p');
}
$join = '';
if ($this->hasColumn('forum_threads', 'board_id') && $this->hasTable('forum_boards') && $this->hasTable('forum_categories')) {
$select .= ', fb.slug AS board_slug, fb.title AS board_title, fc.slug AS category_slug, fc.title AS category_title';
@@ -220,6 +226,9 @@ final class Community
public function listPosts(int $threadId): array
{
$select = 'fp.*, p.display_name';
if ($this->hasColumn('user_profiles', 'avatar_skin_tone')) {
$select .= ', ' . Avatar::selectColumns('p');
}
if ($this->hasColumn('forum_posts', 'highlighted_at')) {
$select .= ', hp.display_name AS highlighted_by_name';
} else {