fix: re-add question comments
This commit is contained in:
parent
572fac9ec3
commit
e6915ae849
@ -74,6 +74,7 @@ func ViewQuestion(c *gin.Context) {
|
||||
newFilteredQuestion.ShortenedBody = shortenedBody
|
||||
|
||||
comments := utils.FindAndReturnComments(questionBodyParentHTML, questionPostLayout)
|
||||
newFilteredQuestion.Comments = comments
|
||||
|
||||
// parse any code blocks and highlight them
|
||||
answerCodeBlocks := questionCodeBlockRegex.FindAllString(questionBodyParentHTML, -1)
|
||||
|
@ -9,4 +9,5 @@ type FilteredQuestion struct {
|
||||
AuthorName string
|
||||
AuthorURL string
|
||||
ShortenedBody string
|
||||
Comments []FilteredComment
|
||||
}
|
||||
|
@ -46,6 +46,34 @@
|
||||
</p>
|
||||
</div>
|
||||
<div class="card-body">{{ .question.Body }}</div>
|
||||
{{ if .question.Comments }}
|
||||
<details class="comments">
|
||||
<summary>
|
||||
Show <b>{{ (len .question.Comments) }} comments</b>
|
||||
</summary>
|
||||
<div class="comments-parent">
|
||||
{{ range $comment := .question.Comments }}
|
||||
<div class="comment-parent">
|
||||
<div class="comment">
|
||||
<div class="comment-body">
|
||||
{{ $comment.Text }}
|
||||
</div>
|
||||
<div class="comment-author">
|
||||
Commented {{ $comment.Timestamp }} by
|
||||
<a
|
||||
href="https://stackoverflow.com{{ $comment.AuthorURL }}"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>{{ $comment.AuthorName }}</a
|
||||
>.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
</div>
|
||||
</details>
|
||||
{{end}}
|
||||
|
||||
</div>
|
||||
<hr class="post-divider" />
|
||||
<h2>Answers</h2>
|
||||
|
Loading…
x
Reference in New Issue
Block a user