Don't panic when receiving a nested comment

This commit is contained in:
Bat 2018-05-10 14:32:19 +01:00
parent a436f2da4b
commit 80964b1857

View file

@ -37,7 +37,7 @@ pub trait Inbox: Actor + Sized {
in_response_to_id: previous_comment.clone().map(|c| c.id),
post_id: previous_comment
.map(|c| c.post_id)
.unwrap_or(Post::get_by_ap_url(conn, act["object"]["inReplyTo"].as_str().unwrap().to_string()).unwrap().id),
.unwrap_or_else(|| Post::get_by_ap_url(conn, act["object"]["inReplyTo"].as_str().unwrap().to_string()).unwrap().id),
author_id: User::from_url(conn, act["actor"].as_str().unwrap().to_string()).unwrap().id,
sensitive: act["object"]["sensitive"].as_bool().unwrap_or(false)
});