feat(frontend): expand first-level comments by default

This commit is contained in:
Tim
2025-08-01 12:09:10 +08:00
parent d4d8245671
commit 847426a507

View File

@@ -216,15 +216,15 @@ export default {
}
}
const mapComment = c => ({
const mapComment = (c, level = 0) => ({
id: c.id,
userName: c.author.username,
time: TimeManager.format(c.createdAt),
avatar: c.author.avatar,
text: c.content,
reactions: c.reactions || [],
reply: (c.replies || []).map(mapComment),
openReplies: false,
reply: (c.replies || []).map(r => mapComment(r, level + 1)),
openReplies: level === 0,
src: c.author.avatar,
iconClick: () => router.push(`/users/${c.author.id}`)
})