- updated_comment
- .send_like(&local_user_view.person, context)
- .await?;
-
- let person_id = local_user_view.person.id;
- let mut comment_view = blocking(context.pool(), move |conn| {
- CommentView::read(conn, inserted_comment.id, Some(person_id))
- })
- .await??;
-
- // If its a comment to yourself, mark it as read
- let comment_id = comment_view.comment.id;
- if local_user_view.person.id == comment_view.get_recipient_id() {
- blocking(context.pool(), move |conn| {
- Comment::update_read(conn, comment_id, true)
- })
- .await?
- .map_err(|_| ApiError::err("couldnt_update_comment"))?;
- comment_view.comment.read = true;
+ // If the parent has PersonMentions mark them as read too
+ let person_id = local_user_view.person.id;
+ let person_mention =
+ PersonMention::read_by_comment_and_person(&mut context.pool(), parent_id, person_id).await;
+ if let Ok(mention) = person_mention {
+ PersonMention::update(
+ &mut context.pool(),
+ mention.id,
+ &PersonMentionUpdateForm { read: Some(true) },
+ )
+ .await
+ .with_lemmy_type(LemmyErrorType::CouldntUpdatePersonMentions)?;
+ }