Merge pull request #159 from Ilphrin/master

Add a link to the blog on article cards
This commit is contained in:
Baptiste Gelez
2018-07-25 21:40:27 +02:00
committed by GitHub
3 changed files with 20 additions and 2 deletions
+4 -2
View File
@@ -202,11 +202,13 @@ impl Post {
}
pub fn to_json(&self, conn: &PgConnection) -> serde_json::Value {
let blog = self.get_blog(conn);
json!({
"post": self,
"author": self.get_authors(conn)[0].to_json(conn),
"url": format!("/~/{}/{}/", self.get_blog(conn).actor_id, self.slug),
"date": self.creation_date.timestamp()
"url": format!("/~/{}/{}/", blog.actor_id, self.slug),
"date": self.creation_date.timestamp(),
"blog": blog.to_json(conn)
})
}