Define Post::slug()

This commit is contained in:
Kitaiti Makoto 2021-04-10 16:30:50 +09:00
parent 859a1fd528
commit 87457c0ed1
1 changed files with 5 additions and 0 deletions

View File

@ -253,6 +253,11 @@ impl Post {
ap_url(&format!("{}/~/{}/{}/", CONFIG.base_url, blog.fqn, slug))
}
// It's better to calc slug in insert and update
pub fn slug(title: &str) -> &str {
title
}
pub fn get_authors(&self, conn: &Connection) -> Result<Vec<User>> {
use crate::schema::post_authors;
use crate::schema::users;