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
|
newFilteredQuestion.ShortenedBody = shortenedBody
|
||||||
|
|
||||||
comments := utils.FindAndReturnComments(questionBodyParentHTML, questionPostLayout)
|
comments := utils.FindAndReturnComments(questionBodyParentHTML, questionPostLayout)
|
||||||
|
newFilteredQuestion.Comments = comments
|
||||||
|
|
||||||
// parse any code blocks and highlight them
|
// parse any code blocks and highlight them
|
||||||
answerCodeBlocks := questionCodeBlockRegex.FindAllString(questionBodyParentHTML, -1)
|
answerCodeBlocks := questionCodeBlockRegex.FindAllString(questionBodyParentHTML, -1)
|
||||||
|
@ -9,4 +9,5 @@ type FilteredQuestion struct {
|
|||||||
AuthorName string
|
AuthorName string
|
||||||
AuthorURL string
|
AuthorURL string
|
||||||
ShortenedBody string
|
ShortenedBody string
|
||||||
|
Comments []FilteredComment
|
||||||
}
|
}
|
||||||
|
@ -46,6 +46,34 @@
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body">{{ .question.Body }}</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>
|
</div>
|
||||||
<hr class="post-divider" />
|
<hr class="post-divider" />
|
||||||
<h2>Answers</h2>
|
<h2>Answers</h2>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user