Addressing PR comments.

This commit is contained in:
Dessalines 2024-05-23 22:14:05 -04:00
parent 9e7a4e474a
commit 7c7a4917e7
5 changed files with 3 additions and 6 deletions

View file

@ -68,7 +68,6 @@ pub async fn like_post(
.with_lemmy_type(LemmyErrorType::CouldntLikePost)?;
}
// Mark the post as read
mark_post_as_read(person_id, post_id, &mut context.pool()).await?;
let community = Community::read(&mut context.pool(), post.community_id)

View file

@ -38,7 +38,6 @@ pub async fn save_post(
.await?
.ok_or(LemmyErrorType::CouldntFindPost)?;
// Mark the post as read
mark_post_as_read(person_id, post_id, &mut context.pool()).await?;
Ok(Json(PostResponse { post_view }))

View file

@ -140,6 +140,7 @@ pub fn is_top_mod(
}
}
/// Marks a post as read for a given person.
#[tracing::instrument(skip_all)]
pub async fn mark_post_as_read(
person_id: PersonId,
@ -166,9 +167,11 @@ pub async fn update_read_comments(
read_comments,
..PersonPostAggregatesForm::default()
};
PersonPostAggregates::upsert(pool, &person_post_agg_form)
.await
.with_lemmy_type(LemmyErrorType::CouldntFindPost)?;
Ok(())
}

View file

@ -176,7 +176,6 @@ pub async fn create_post(
.await
.with_lemmy_type(LemmyErrorType::CouldntLikePost)?;
// Mark the post as read
mark_post_as_read(person_id, post_id, &mut context.pool()).await?;
if let Some(url) = updated_post.url.clone() {

View file

@ -61,11 +61,8 @@ pub async fn get_post(
let post_id = post_view.post.id;
if let Some(person_id) = person_id {
// Mark the post as read
mark_post_as_read(person_id, post_id, &mut context.pool()).await?;
// Insert into PersonPostAggregates
// to update the read_comments count
update_read_comments(
person_id,
post_id,