mirror of
https://github.com/LemmyNet/lemmy
synced 2024-11-03 09:40:16 +00:00
Moving send email check inside function.
This commit is contained in:
parent
270ce539bf
commit
99e5a4d1c3
@ -1157,14 +1157,12 @@ impl Perform for CreatePrivateMessage {
|
|||||||
})
|
})
|
||||||
.await?
|
.await?
|
||||||
{
|
{
|
||||||
if local_recipient.local_user.send_notifications_to_email {
|
|
||||||
send_email_to_user(
|
send_email_to_user(
|
||||||
&local_recipient,
|
&local_recipient,
|
||||||
"Private Message from",
|
"Private Message from",
|
||||||
"Private Message",
|
"Private Message",
|
||||||
&content_slurs_removed,
|
&content_slurs_removed,
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
let local_recipient_id = local_recipient.local_user.id;
|
let local_recipient_id = local_recipient.local_user.id;
|
||||||
context.chat_server().do_send(SendUserRoomMessage {
|
context.chat_server().do_send(SendUserRoomMessage {
|
||||||
|
@ -101,7 +101,7 @@ fn do_send_local_notifs(
|
|||||||
PersonMention::create(&conn, &user_mention_form).ok();
|
PersonMention::create(&conn, &user_mention_form).ok();
|
||||||
|
|
||||||
// Send an email to those local users that have notifications on
|
// Send an email to those local users that have notifications on
|
||||||
if do_send_email && mention_user_view.local_user.send_notifications_to_email {
|
if do_send_email {
|
||||||
send_email_to_user(
|
send_email_to_user(
|
||||||
&mention_user_view,
|
&mention_user_view,
|
||||||
"Mentioned by",
|
"Mentioned by",
|
||||||
@ -121,7 +121,7 @@ fn do_send_local_notifs(
|
|||||||
{
|
{
|
||||||
recipient_ids.push(parent_user_view.local_user.id);
|
recipient_ids.push(parent_user_view.local_user.id);
|
||||||
|
|
||||||
if do_send_email && parent_user_view.local_user.send_notifications_to_email {
|
if do_send_email {
|
||||||
send_email_to_user(
|
send_email_to_user(
|
||||||
&parent_user_view,
|
&parent_user_view,
|
||||||
"Reply from",
|
"Reply from",
|
||||||
@ -139,7 +139,7 @@ fn do_send_local_notifs(
|
|||||||
if let Ok(parent_user_view) = LocalUserView::read_person(&conn, post.creator_id) {
|
if let Ok(parent_user_view) = LocalUserView::read_person(&conn, post.creator_id) {
|
||||||
recipient_ids.push(parent_user_view.local_user.id);
|
recipient_ids.push(parent_user_view.local_user.id);
|
||||||
|
|
||||||
if do_send_email && parent_user_view.local_user.send_notifications_to_email {
|
if do_send_email {
|
||||||
send_email_to_user(
|
send_email_to_user(
|
||||||
&parent_user_view,
|
&parent_user_view,
|
||||||
"Reply from",
|
"Reply from",
|
||||||
@ -160,7 +160,7 @@ pub fn send_email_to_user(
|
|||||||
body_text: &str,
|
body_text: &str,
|
||||||
comment_content: &str,
|
comment_content: &str,
|
||||||
) {
|
) {
|
||||||
if local_user_view.person.banned {
|
if local_user_view.person.banned || !local_user_view.local_user.send_notifications_to_email {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user