- // 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()
- };
- blocking(context.pool(), move |conn| {
- PersonPostAggregates::upsert(conn, &person_post_agg_form)
- })
- .await?
- .map_err(|e| LemmyError::from_error_message(e, "couldnt_find_post"))?;
- }
+ // 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(&mut context.pool(), &person_post_agg_form)
+ .await
+ .with_lemmy_type(LemmyErrorType::CouldntFindPost)?;
+ }