]> Untitled Git - lemmy.git/blobdiff - crates/api_crud/src/private_message/create.rs
Use async email sender (#3554)
[lemmy.git] / crates / api_crud / src / private_message / create.rs
index 3b3dd70c1d8cfe45be3a30fc5e45e1f22f50a8fd..187b3f90ae6149dd6ac0fdb6458e37dfb4159f9e 100644 (file)
@@ -43,7 +43,7 @@ impl PerformCrud for CreatePrivateMessage {
       &data.content.clone(),
       &local_site_to_slur_regex(&local_site),
     );
-    is_valid_body_field(&Some(content_slurs_removed.clone()))?;
+    is_valid_body_field(&Some(content_slurs_removed.clone()), false)?;
 
     check_person_block(local_user_view.person.id, data.recipient_id, context.pool()).await?;
 
@@ -89,16 +89,14 @@ impl PerformCrud for CreatePrivateMessage {
       let local_recipient = LocalUserView::read_person(context.pool(), recipient_id).await?;
       let lang = get_interface_language(&local_recipient);
       let inbox_link = format!("{}/inbox", context.settings().get_protocol_and_hostname());
+      let sender_name = &local_user_view.person.name;
       send_email_to_user(
         &local_recipient,
-        &lang.notification_private_message_subject(&local_recipient.person.name),
-        &lang.notification_private_message_body(
-          inbox_link,
-          &content_slurs_removed,
-          &local_recipient.person.name,
-        ),
+        &lang.notification_private_message_subject(sender_name),
+        &lang.notification_private_message_body(inbox_link, &content_slurs_removed, sender_name),
         context.settings(),
-      );
+      )
+      .await;
     }
 
     Ok(PrivateMessageResponse {