From fb88a5b3b41e14baa3588af858882f8d80362420 Mon Sep 17 00:00:00 2001 From: Felix Ableitner Date: Mon, 24 Aug 2020 17:00:06 +0200 Subject: [PATCH] added logging --- server/lemmy_db/src/comment.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/server/lemmy_db/src/comment.rs b/server/lemmy_db/src/comment.rs index 836e27a29..71505c1c2 100644 --- a/server/lemmy_db/src/comment.rs +++ b/server/lemmy_db/src/comment.rs @@ -61,6 +61,7 @@ impl Crud for Comment { } fn create(conn: &PgConnection, comment_form: &CommentForm) -> Result { + println!("creating {}", &comment_form.ap_id); use crate::schema::comment::dsl::*; insert_into(comment) .values(comment_form) @@ -163,13 +164,17 @@ impl Comment { } pub fn upsert(conn: &PgConnection, comment_form: &CommentForm) -> Result { + println!("Comment::upsert() (entered into function)"); let existing = Self::read_from_apub_id(conn, &comment_form.ap_id); - match existing { + println!("Comment::upsert() (checked if comment exists)"); + let x = match existing { Err(NotFound {}) => Ok(Self::create(conn, &comment_form)?), // both the old and new comment should be identical so no need to do an update here Ok(p) => Ok(Self::read(conn, p.id)?), Err(e) => Err(e), - } + }; + println!("Comment::upsert() (after match statement)"); + x } }