sort Q&A comments - closes #3571

pull/3584/head
Thibault Duplessis 2017-09-04 13:45:32 -05:00
parent c802556c39
commit 6cee95c359
3 changed files with 6 additions and 3 deletions

View File

@ -66,7 +66,7 @@
</form>
}
<div class="comments" id="answer-@a.id-comments">
@views.html.qa.commentList(q, a.comments, routes.QaComment.answer(q.id, a.id).url)
@views.html.qa.commentList(q, a.comments.sorted, routes.QaComment.answer(q.id, a.id).url)
</div>
</div>
</div>

View File

@ -55,7 +55,7 @@ description = shorten(q.body.replace("\n", ""), 152).body).some) {
@autoLink(q.body)
</div>
<div class="comments" id="question-@q.id-comments">
@views.html.qa.commentList(q, q.comments, routes.QaComment.question(q.id).url)
@views.html.qa.commentList(q, q.comments.sorted, routes.QaComment.question(q.id).url)
</div>
</div>
</div>

View File

@ -86,7 +86,10 @@ case class Comment(
userId: String,
body: String,
createdAt: DateTime
)
) extends Ordered[Comment] {
def compare(other: Comment) = createdAt.getSeconds compare other.createdAt.getSeconds
}
object Comment {