mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-10-01 01:36:12 -04:00
Dont send email notifications for edited comments (fixes #1925)
This commit is contained in:
parent
1579ee566f
commit
27a687bcd0
@ -108,7 +108,15 @@ impl ActivityHandler for CreateOrUpdateComment {
|
|||||||
request_counter: &mut i32,
|
request_counter: &mut i32,
|
||||||
) -> Result<(), LemmyError> {
|
) -> Result<(), LemmyError> {
|
||||||
let comment = ApubComment::from_apub(self.object, context, request_counter).await?;
|
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 {
|
let notif_type = match self.kind {
|
||||||
CreateOrUpdateType::Create => UserOperationCrud::CreateComment,
|
CreateOrUpdateType::Create => UserOperationCrud::CreateComment,
|
||||||
CreateOrUpdateType::Update => UserOperationCrud::EditComment,
|
CreateOrUpdateType::Update => UserOperationCrud::EditComment,
|
||||||
|
@ -14,6 +14,7 @@ pub mod create_or_update;
|
|||||||
async fn get_notif_recipients(
|
async fn get_notif_recipients(
|
||||||
actor: &ObjectId<ApubPerson>,
|
actor: &ObjectId<ApubPerson>,
|
||||||
comment: &Comment,
|
comment: &Comment,
|
||||||
|
do_send_email: bool,
|
||||||
context: &LemmyContext,
|
context: &LemmyContext,
|
||||||
request_counter: &mut i32,
|
request_counter: &mut i32,
|
||||||
) -> Result<Vec<LocalUserId>, LemmyError> {
|
) -> Result<Vec<LocalUserId>, LemmyError> {
|
||||||
@ -27,5 +28,5 @@ async fn get_notif_recipients(
|
|||||||
// anyway.
|
// anyway.
|
||||||
// TODO: for compatibility with other projects, it would be much better to read this from cc or tags
|
// 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);
|
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
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user