]> Untitled Git - lemmy.git/blobdiff - crates/api_crud/src/private_message/create.rs
Implement reports for private messages (#2433)
[lemmy.git] / crates / api_crud / src / private_message / create.rs
index de711128d4124fb956f497a7fb1bf96bb03ed9e8..278031311ed938504c0d1a82731bb687e8e71735 100644 (file)
@@ -1,12 +1,12 @@
 use crate::PerformCrud;
 use actix_web::web::Data;
 use lemmy_api_common::{
-  person::{CreatePrivateMessage, PrivateMessageResponse},
+  private_message::{CreatePrivateMessage, PrivateMessageResponse},
   utils::{
     blocking,
     check_person_block,
+    get_interface_language,
     get_local_user_view_from_jwt,
-    get_user_lang,
     send_email_to_user,
   },
 };
@@ -23,7 +23,7 @@ use lemmy_db_schema::{
   traits::Crud,
 };
 use lemmy_db_views::structs::LocalUserView;
-use lemmy_utils::{utils::remove_slurs, ConnectionId, LemmyError};
+use lemmy_utils::{error::LemmyError, utils::remove_slurs, ConnectionId};
 use lemmy_websocket::{send::send_pm_ws_message, LemmyContext, UserOperationCrud};
 
 #[async_trait::async_trait(?Send)]
@@ -109,17 +109,17 @@ impl PerformCrud for CreatePrivateMessage {
         LocalUserView::read_person(conn, recipient_id)
       })
       .await??;
-      let lang = get_user_lang(&local_recipient);
+      let lang = get_interface_language(&local_recipient);
       let inbox_link = format!("{}/inbox", context.settings().get_protocol_and_hostname());
       send_email_to_user(
         &local_recipient,
-        &lang.notification_mentioned_by_subject(&local_recipient.person.name),
-        &lang.notification_mentioned_by_body(
-          &local_recipient.person.name,
-          &content_slurs_removed,
+        &lang.notification_private_message_subject(&local_recipient.person.name),
+        &lang.notification_private_message_body(
           &inbox_link,
+          &content_slurs_removed,
+          &local_recipient.person.name,
         ),
-        &context.settings(),
+        context.settings(),
       );
     }