From 2ffd357d9511a5de86ea24c1757fd970616a40e3 Mon Sep 17 00:00:00 2001 From: Kitaiti Makoto Date: Mon, 29 Mar 2021 01:38:28 +0900 Subject: [PATCH] Update Post.ap_url when published --- src/routes/posts.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/routes/posts.rs b/src/routes/posts.rs index 1aafe578..78854006 100644 --- a/src/routes/posts.rs +++ b/src/routes/posts.rs @@ -290,6 +290,13 @@ pub fn update( let newly_published = if !post.published && !form.draft { post.published = true; post.creation_date = Utc::now().naive_utc(); + // TODO: share code with Post::insert() + post.ap_url = plume_models::ap_url(&format!( + "{}/~/{}/{}/", + CONFIG.base_url, + post.get_blog(&conn).unwrap().fqn, + new_slug + )); true } else { false