|
|
|
@ -11,7 +11,6 @@ use activitypub::{
|
|
|
|
|
};
|
|
|
|
|
use chrono::{NaiveDateTime, TimeZone, Utc};
|
|
|
|
|
use diesel::{self, BelongingToDsl, ExpressionMethods, QueryDsl, RunQueryDsl, SaveChangesDsl};
|
|
|
|
|
use heck::KebabCase;
|
|
|
|
|
use once_cell::sync::Lazy;
|
|
|
|
|
use plume_common::{
|
|
|
|
|
activity_pub::{
|
|
|
|
@ -653,12 +652,12 @@ impl FromId<DbConn> for Post {
|
|
|
|
|
.and_then(|mut post| {
|
|
|
|
|
let mut updated = false;
|
|
|
|
|
|
|
|
|
|
let slug = title.to_kebab_case();
|
|
|
|
|
let slug = Self::slug(&title);
|
|
|
|
|
let content = SafeString::new(&article.object_props.content_string()?);
|
|
|
|
|
let subtitle = article.object_props.summary_string()?;
|
|
|
|
|
let source = article.ap_object_props.source_object::<Source>()?.content;
|
|
|
|
|
if post.slug != slug {
|
|
|
|
|
post.slug = slug;
|
|
|
|
|
post.slug = slug.to_string();
|
|
|
|
|
updated = true;
|
|
|
|
|
}
|
|
|
|
|
if post.title != title {
|
|
|
|
@ -697,7 +696,7 @@ impl FromId<DbConn> for Post {
|
|
|
|
|
conn,
|
|
|
|
|
NewPost {
|
|
|
|
|
blog_id: blog?.id,
|
|
|
|
|
slug: title.to_kebab_case(),
|
|
|
|
|
slug: Self::slug(&title).to_string(),
|
|
|
|
|
title,
|
|
|
|
|
content: SafeString::new(&article.object_props.content_string()?),
|
|
|
|
|
published: true,
|
|
|
|
@ -842,7 +841,7 @@ impl AsObject<User, Update, &DbConn> for PostUpdate {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if let Some(title) = self.title {
|
|
|
|
|
post.slug = title.to_kebab_case();
|
|
|
|
|
post.slug = Post::slug(&title).to_string();
|
|
|
|
|
post.title = title;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|