-use lemmy_utils::LemmyError;
-use lemmy_websocket::{send::send_comment_ws_message, LemmyContext, UserOperationCrud};
-
-impl CreateOrUpdateComment {
- #[tracing::instrument(skip(comment, actor, kind, context))]
- pub async fn send(
- comment: ApubComment,
- actor: &ApubPerson,
+use lemmy_utils::{error::LemmyError, utils::mention::scrape_text_for_mentions};
+use url::Url;
+
+#[async_trait::async_trait]
+impl SendActivity for CreateComment {
+ type Response = CommentResponse;
+
+ async fn send_activity(
+ _request: &Self,
+ response: &Self::Response,
+ context: &Data<LemmyContext>,
+ ) -> Result<(), LemmyError> {
+ CreateOrUpdateNote::send(
+ &response.comment_view.comment,
+ response.comment_view.creator.id,
+ CreateOrUpdateType::Create,
+ context,
+ )
+ .await
+ }
+}
+
+#[async_trait::async_trait]
+impl SendActivity for EditComment {
+ type Response = CommentResponse;
+
+ async fn send_activity(
+ _request: &Self,
+ response: &Self::Response,
+ context: &Data<LemmyContext>,
+ ) -> Result<(), LemmyError> {
+ CreateOrUpdateNote::send(
+ &response.comment_view.comment,
+ response.comment_view.creator.id,
+ CreateOrUpdateType::Update,
+ context,
+ )
+ .await
+ }
+}
+
+impl CreateOrUpdateNote {
+ #[tracing::instrument(skip(comment, person_id, kind, context))]
+ async fn send(
+ comment: &Comment,
+ person_id: PersonId,