- let recipients =
- get_comment_notif_recipients(&self.actor, &comment, do_send_email, context).await?;
- let notif_type = match self.kind {
- CreateOrUpdateType::Create => UserOperationCrud::CreateComment,
- CreateOrUpdateType::Update => UserOperationCrud::EditComment,
- };
- send_comment_ws_message(
- comment.id, notif_type, None, None, None, recipients, context,
- )
- .await?;
+ let post_id = comment.post_id;
+ let post = Post::read(&mut context.pool(), post_id).await?;
+ let actor = self.actor.dereference(context).await?;
+
+ // Note:
+ // Although mentions could be gotten from the post tags (they are included there), or the ccs,
+ // Its much easier to scrape them from the comment body, since the API has to do that
+ // anyway.
+ // TODO: for compatibility with other projects, it would be much better to read this from cc or tags
+ let mentions = scrape_text_for_mentions(&comment.content);
+ send_local_notifs(mentions, &comment.0, &actor, &post, do_send_email, context).await?;