feat: show avatars in my comments

This commit is contained in:
hajimi
2026-08-03 20:44:32 +08:00
parent 22113f9af8
commit 0ecdd18495
2 changed files with 45 additions and 1 deletions
@@ -358,7 +358,11 @@ class CommunityController extends BaseApiController
}
}
$currentUser = User::field('id,nickname,avatar')->where('id', $this->userId)->findOrEmpty();
$currentUserData = $currentUser->isEmpty() ? null : $currentUser->toArray();
foreach ($list as &$item) {
$item['user'] = $currentUserData;
$post = $postMap[$item['post_id']] ?? null;
$item['post'] = $post && (int) $post['status'] === 1 ? [
'id' => $post['id'],