- // 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 {
- Comment::read(&mut context.pool(), comment_id)
- .await
- .with_lemmy_type(LemmyErrorType::CouldntFindPost)?
- .post_id
- } else {
- Err(LemmyErrorType::CouldntFindPost)?
- };
-
- // Check to see if the person is a mod or admin, to show deleted / removed
- let community_id = Post::read(&mut context.pool(), post_id).await?.community_id;
- let is_mod_or_admin = is_mod_or_admin_opt(
- &mut context.pool(),
- local_user_view.as_ref(),
- Some(community_id),
- )
- .await
- .is_ok();
+ // Check to see if the person is a mod or admin, to show deleted / removed
+ let community_id = Post::read(&mut context.pool(), post_id).await?.community_id;
+ let is_mod_or_admin = is_mod_or_admin_opt(
+ &mut context.pool(),
+ local_user_view.as_ref(),
+ Some(community_id),
+ )
+ .await
+ .is_ok();