1 use crate::{local_instance, objects::person::ApubPerson};
2 use activitypub_federation::core::object_id::ObjectId;
5 source::{comment::Comment, post::Post},
8 use lemmy_utils::{error::LemmyError, utils::scrape_text_for_mentions};
9 use lemmy_websocket::{send::send_local_notifs, LemmyContext};
13 pub mod private_message;
15 #[tracing::instrument(skip_all)]
16 async fn get_comment_notif_recipients(
17 actor: &ObjectId<ApubPerson>,
20 context: &LemmyContext,
21 request_counter: &mut i32,
22 ) -> Result<Vec<LocalUserId>, LemmyError> {
23 let post_id = comment.post_id;
24 let post = Post::read(context.pool(), post_id).await?;
26 .dereference(context, local_instance(context).await, request_counter)
30 // Although mentions could be gotten from the post tags (they are included there), or the ccs,
31 // Its much easier to scrape them from the comment body, since the API has to do that
33 // TODO: for compatibility with other projects, it would be much better to read this from cc or tags
34 let mentions = scrape_text_for_mentions(&comment.content);
35 send_local_notifs(mentions, comment, &actor, &post, do_send_email, context).await