- Some(is_mod_or_admin),
- )
- .await
- .map_err(|e| LemmyError::from_error_message(e, "couldnt_find_community"))?;
-
- // Insert into PersonPostAggregates
- // to update the read_comments count
- if let Some(person_id) = person_id {
- let read_comments = post_view.counts.comments;
- let person_post_agg_form = PersonPostAggregatesForm {
- person_id,
- post_id,
- read_comments,
- ..PersonPostAggregatesForm::default()
- };
- PersonPostAggregates::upsert(context.pool(), &person_post_agg_form)
- .await
- .map_err(|e| LemmyError::from_error_message(e, "couldnt_find_post"))?;
- }
+ post_id,
+ read_comments,
+ ..PersonPostAggregatesForm::default()
+ };
+ PersonPostAggregates::upsert(&mut context.pool(), &person_post_agg_form)
+ .await
+ .with_lemmy_type(LemmyErrorType::CouldntFindPost)?;
+ }