Display article covers

This commit is contained in:
Baptiste Gelez
2018-10-31 11:43:56 +01:00
parent 95326c09e0
commit 4a2f5aeeeb
4 changed files with 32 additions and 3 deletions
+2 -1
View File
@@ -526,7 +526,8 @@ impl Post {
"url": format!("/~/{}/{}/", blog.get_fqn(conn), self.slug),
"date": self.creation_date.timestamp(),
"blog": blog.to_json(conn),
"tags": Tag::for_post(&*conn, self.id)
"tags": Tag::for_post(&*conn, self.id),
"cover": self.cover_id.and_then(|i| Media::get(conn, i).map(|m| m.to_json(conn))),
})
}