Fix Post::from_activity07()
This commit is contained in:
parent
38ebc9ea41
commit
de6e9c0e2e
@ -1031,20 +1031,27 @@ impl FromId07<DbConn> for Post {
|
|||||||
let article = article.inner;
|
let article = article.inner;
|
||||||
|
|
||||||
let (blog, authors) = article
|
let (blog, authors) = article
|
||||||
|
.ap_object_ref()
|
||||||
.attributed_to()
|
.attributed_to()
|
||||||
.ok_or(Error::MissingApProperty)
|
.ok_or(Error::MissingApProperty)?
|
||||||
.iter()
|
.iter()
|
||||||
.fold((None, vec![]), |(blog, mut authors), link| {
|
.fold((None, vec![]), |(blog, mut authors), link| {
|
||||||
let url = link.to_as_uri().expect("Exists");
|
if let Some(url) = link.id() {
|
||||||
match User::from_id(conn, &url, None, CONFIG.proxy()) {
|
match User::from_id07(conn, url.as_str(), None, CONFIG.proxy()) {
|
||||||
Ok(u) => {
|
Ok(u) => {
|
||||||
authors.push(u);
|
authors.push(u);
|
||||||
(blog, authors)
|
(blog, authors)
|
||||||
|
}
|
||||||
|
Err(_) => (
|
||||||
|
blog.or_else(|| {
|
||||||
|
Blog::from_id07(conn, url.as_str(), None, CONFIG.proxy()).ok()
|
||||||
|
}),
|
||||||
|
authors,
|
||||||
|
),
|
||||||
}
|
}
|
||||||
Err(_) => (
|
} else {
|
||||||
blog.or_else(|| Blog::from_id(conn, &url, None, CONFIG.proxy()).ok()),
|
// logically, url possible to be an object without id proprty like {"type":"Person", "name":"Sally"} but we ignore the case
|
||||||
authors,
|
(blog, authors)
|
||||||
),
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user