Use the creation date from ActivityPub when fetching remote articles
This commit is contained in:
parent
0314629d99
commit
812b76b0de
@ -45,6 +45,7 @@ pub struct NewPost {
|
||||
pub content: SafeString,
|
||||
pub published: bool,
|
||||
pub license: String,
|
||||
pub creation_date: Option<NaiveDateTime>,
|
||||
pub ap_url: String
|
||||
}
|
||||
|
||||
@ -248,7 +249,8 @@ impl FromActivity<Article, PgConnection> for Post {
|
||||
published: true,
|
||||
license: String::from("CC-0"), // TODO
|
||||
// FIXME: This is wrong: with this logic, we may use the display URL as the AP ID. We need two different fields
|
||||
ap_url: article.object_props.url_string().unwrap_or(article.object_props.id_string().expect("Post::from_activity: url + id error"))
|
||||
ap_url: article.object_props.url_string().unwrap_or(article.object_props.id_string().expect("Post::from_activity: url + id error")),
|
||||
creation_date: Some(article.object_props.published_utctime().expect("Post::from_activity: published error").naive_utc())
|
||||
});
|
||||
|
||||
for author in authors.into_iter() {
|
||||
|
@ -142,7 +142,8 @@ fn create(blog_name: String, data: LenientForm<NewPostForm>, user: User, conn: D
|
||||
content: SafeString::new(&content),
|
||||
published: true,
|
||||
license: form.license.to_string(),
|
||||
ap_url: "".to_string()
|
||||
ap_url: "".to_string(),
|
||||
creation_date: None
|
||||
});
|
||||
let post = post.update_ap_url(&*conn);
|
||||
PostAuthor::insert(&*conn, NewPostAuthor {
|
||||
|
Loading…
Reference in New Issue
Block a user