From 80964b18571c887a797e75e91813e6d9d7ae6123 Mon Sep 17 00:00:00 2001 From: Bat Date: Thu, 10 May 2018 14:32:19 +0100 Subject: [PATCH] Don't panic when receiving a nested comment --- src/activity_pub/inbox.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/activity_pub/inbox.rs b/src/activity_pub/inbox.rs index a58e86b0..33dbadf4 100644 --- a/src/activity_pub/inbox.rs +++ b/src/activity_pub/inbox.rs @@ -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) });