From: Felix Ableitner Date: Wed, 24 Nov 2021 21:26:23 +0000 (+0100) Subject: Dont send email notifications for edited comments (fixes #1925) X-Git-Url: http://these/git/%7Bthis.props.site.site.icon%7D?a=commitdiff_plain;h=27a687bcd0b2cd362d02f0fb10a16c80a6a6aa55;p=lemmy.git Dont send email notifications for edited comments (fixes #1925) --- diff --git a/crates/apub/src/activities/comment/create_or_update.rs b/crates/apub/src/activities/comment/create_or_update.rs index 14fc1401..649f566c 100644 --- a/crates/apub/src/activities/comment/create_or_update.rs +++ b/crates/apub/src/activities/comment/create_or_update.rs @@ -108,7 +108,15 @@ impl ActivityHandler for CreateOrUpdateComment { request_counter: &mut i32, ) -> Result<(), LemmyError> { let comment = ApubComment::from_apub(self.object, context, request_counter).await?; - let recipients = get_notif_recipients(&self.actor, &comment, context, request_counter).await?; + let do_send_email = self.kind == CreateOrUpdateType::Create; + let recipients = get_notif_recipients( + &self.actor, + &comment, + do_send_email, + context, + request_counter, + ) + .await?; let notif_type = match self.kind { CreateOrUpdateType::Create => UserOperationCrud::CreateComment, CreateOrUpdateType::Update => UserOperationCrud::EditComment, diff --git a/crates/apub/src/activities/comment/mod.rs b/crates/apub/src/activities/comment/mod.rs index b4253858..17b4f50c 100644 --- a/crates/apub/src/activities/comment/mod.rs +++ b/crates/apub/src/activities/comment/mod.rs @@ -14,6 +14,7 @@ pub mod create_or_update; async fn get_notif_recipients( actor: &ObjectId, comment: &Comment, + do_send_email: bool, context: &LemmyContext, request_counter: &mut i32, ) -> Result, LemmyError> { @@ -27,5 +28,5 @@ async fn get_notif_recipients( // 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, &*actor, &post, true, context).await + send_local_notifs(mentions, comment, &*actor, &post, do_send_email, context).await }