Skip to content

Commit def5dc6

Browse files
authored
Update server.js
1 parent ee89d55 commit def5dc6

File tree

1 file changed

+13
-17
lines changed

1 file changed

+13
-17
lines changed

src/npm/server.js

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -99,24 +99,20 @@ app.get('/wiki/:title', (req, res) => {
9999
100100
<div class="comment-section">
101101
<h3>Comments</h3>
102-
${wiki.comments.slice(-7).map(comment => {
103-
return `
104-
<div class="comment" id="comment-${comment.id}">
105-
<div class="comment-author">
106-
${comment.author} <small>(${new Date(comment.createdAt).toLocaleString()})</small>
107-
</div>
108-
<div class="comment-content">${escapeHtml(comment.content)}</div>
109-
${comment.replies.length > 0 ? comment.replies.map(reply => {
110-
return `
111-
<div class="comment-reply">
112-
<strong>${reply.author}</strong>: ${escapeHtml(reply.content)}
113-
<small>(${new Date(reply.createdAt).toLocaleString()})</small>
114-
</div>
115-
`;
116-
}).join('') : ''}
102+
`${wiki.comments.slice(-7).map((comment) => `
103+
<div class="comment" id="comment-${comment.id}">
104+
<div class="comment-author">
105+
${comment.author} <small>(${new Date(comment.createdAt).toLocaleString()})</small>
117106
</div>
118-
`;
119-
}).join('')}
107+
<div class="comment-content">${escapeHtml(comment.content)}</div>
108+
${comment.replies.length > 0 ? comment.replies.map(reply => `
109+
<div class="comment-reply">
110+
<strong>${reply.author}</strong>: ${escapeHtml(reply.content)}
111+
<small>(${new Date(reply.createdAt).toLocaleString()})</small>
112+
</div>
113+
`).join('') : ''}
114+
</div>
115+
`).join('')}`
120116
121117
122118
<div class="comment-form">

0 commit comments

Comments
 (0)