mirror of
https://github.com/nagisa77/OpenIsle.git
synced 2026-08-09 21:00:59 +00:00
feat(frontend): expand first-level comments by default
This commit is contained in:
@@ -216,15 +216,15 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const mapComment = c => ({
|
const mapComment = (c, level = 0) => ({
|
||||||
id: c.id,
|
id: c.id,
|
||||||
userName: c.author.username,
|
userName: c.author.username,
|
||||||
time: TimeManager.format(c.createdAt),
|
time: TimeManager.format(c.createdAt),
|
||||||
avatar: c.author.avatar,
|
avatar: c.author.avatar,
|
||||||
text: c.content,
|
text: c.content,
|
||||||
reactions: c.reactions || [],
|
reactions: c.reactions || [],
|
||||||
reply: (c.replies || []).map(mapComment),
|
reply: (c.replies || []).map(r => mapComment(r, level + 1)),
|
||||||
openReplies: false,
|
openReplies: level === 0,
|
||||||
src: c.author.avatar,
|
src: c.author.avatar,
|
||||||
iconClick: () => router.push(`/users/${c.author.id}`)
|
iconClick: () => router.push(`/users/${c.author.id}`)
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user