Update Post.ap_url when published

This commit is contained in:
Kitaiti Makoto 2021-03-29 01:38:28 +09:00
parent 2bc4a13964
commit 2ffd357d95
1 changed files with 7 additions and 0 deletions

View File

@ -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