From a4a88d850e6fe551a1a1af4bf3a48062a214e4d5 Mon Sep 17 00:00:00 2001 From: nain <126972030+nain-F49FF806@users.noreply.github.com> Date: Sat, 27 Apr 2024 20:09:13 +0200 Subject: [PATCH] simpler comment formatting Co-authored-by: mydayyy@mydayyy.eu --- src/privatebin.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/privatebin.rs b/src/privatebin.rs index d6b4ce2..c9b7761 100644 --- a/src/privatebin.rs +++ b/src/privatebin.rs @@ -229,15 +229,14 @@ impl Paste { }) .collect(); json!({ - id: { - "comment": decrypted_comments.get(id).unwrap_or(&DecryptedComment::default()).comment, - "nickname": decrypted_comments.get(id).unwrap_or(&DecryptedComment::default()).nickname, - "replies": formatted_children - } + "id": id, + "comment": decrypted_comments.get(id).unwrap_or(&DecryptedComment::default()).comment, + "nickname": decrypted_comments.get(id).unwrap_or(&DecryptedComment::default()).nickname, + "replies": formatted_children }) } let top_level = format_comments_below_id(&self.id, decrypted_comments, comment_adjacency); - serde_json::to_string_pretty(&top_level[&self.id]["replies"]).map_err(|e| e.into()) + serde_json::to_string_pretty(&top_level["replies"]).map_err(|e| e.into()) } }