feat(db): Add view for ordering thread index by most recent post

This implements the classic thread ordering expected by most forum
users (i.e. the thread with the most recent post is at the top).
This commit is contained in:
Vincent Ambo 2018-04-14 17:15:27 +02:00
parent cf64826e4e
commit f10bd20276
6 changed files with 45 additions and 7 deletions

View file

@ -47,7 +47,7 @@ impl From<DateTime<Utc>> for FormattedDate {
/// Message used to render the index page.
pub struct IndexPage {
pub threads: Vec<Thread>,
pub threads: Vec<ThreadIndex>,
}
impl Message for IndexPage {
@ -69,7 +69,7 @@ impl Handler<IndexPage> for Renderer {
let threads: Vec<IndexThread> = msg.threads
.into_iter()
.map(|thread| IndexThread {
id: thread.id,
id: thread.thread_id,
title: escape_html(&thread.title),
posted: thread.posted.into(),
author_name: thread.author_name,