+ // I'd prefer fetching the post_view by a comment join, but it adds a lot of boilerplate
+ let post_id = if let Some(id) = data.id {
+ id
+ } else if let Some(comment_id) = data.comment_id {
+ blocking(context.pool(), move |conn| Comment::read(conn, comment_id))
+ .await?
+ .map_err(|e| LemmyError::from_error_message(e, "couldnt_find_post"))?
+ .post_id
+ } else {
+ Err(LemmyError::from_message("couldnt_find_post"))?
+ };
+