From 87457c0ed1d2883e150ac18fe252c7a130527947 Mon Sep 17 00:00:00 2001 From: Kitaiti Makoto Date: Sat, 10 Apr 2021 16:30:50 +0900 Subject: [PATCH] Define Post::slug() --- plume-models/src/posts.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/plume-models/src/posts.rs b/plume-models/src/posts.rs index 1048fb12..8a6e2f91 100644 --- a/plume-models/src/posts.rs +++ b/plume-models/src/posts.rs @@ -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> { use crate::schema::post_authors; use crate::schema::users;