Merge pull request 'Update Post.ap_url when published' (#915) from update-ap-url into main

Reviewed-on: https://git.joinplu.me/Plume/Plume/pulls/915
This commit is contained in:
KitaitiMakoto 2021-03-28 17:27:45 +00:00
commit 112c034e27
2 changed files with 8 additions and 0 deletions

View file

@ -26,6 +26,7 @@
- Menu animation not opening on iOS (#876, #897)
- Make actors subscribe to channel once (#913)
- Upsert posts and media instead of trying to insert and fail (#912)
- Update post's ActivityPub id when published by update
## [[0.6.0]] - 2020-12-29

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