mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-27 06:41:18 +00:00
parent
4157bf9a02
commit
02cf67de4a
1 changed files with 36 additions and 32 deletions
|
@ -137,43 +137,47 @@ impl Perform<CommentResponse> for Oper<CreateComment> {
|
||||||
match data.parent_id {
|
match data.parent_id {
|
||||||
Some(parent_id) => {
|
Some(parent_id) => {
|
||||||
let parent_comment = Comment::read(&conn, parent_id)?;
|
let parent_comment = Comment::read(&conn, parent_id)?;
|
||||||
let parent_user = User_::read(&conn, parent_comment.creator_id)?;
|
if parent_comment.creator_id != user_id {
|
||||||
if parent_user.send_notifications_to_email {
|
let parent_user = User_::read(&conn, parent_comment.creator_id)?;
|
||||||
if let Some(comment_reply_email) = parent_user.email {
|
if parent_user.send_notifications_to_email {
|
||||||
let subject = &format!(
|
if let Some(comment_reply_email) = parent_user.email {
|
||||||
"{} - Reply from {}",
|
let subject = &format!(
|
||||||
Settings::get().hostname,
|
"{} - Reply from {}",
|
||||||
claims.username
|
Settings::get().hostname,
|
||||||
);
|
claims.username
|
||||||
let html = &format!(
|
);
|
||||||
"<h1>Comment Reply</h1><br><div>{} - {}</div><br><a href={}/inbox>inbox</a>",
|
let html = &format!(
|
||||||
claims.username, comment_form.content, hostname
|
"<h1>Comment Reply</h1><br><div>{} - {}</div><br><a href={}/inbox>inbox</a>",
|
||||||
);
|
claims.username, comment_form.content, hostname
|
||||||
match send_email(subject, &comment_reply_email, &parent_user.name, html) {
|
);
|
||||||
Ok(_o) => _o,
|
match send_email(subject, &comment_reply_email, &parent_user.name, html) {
|
||||||
Err(e) => eprintln!("{}", e),
|
Ok(_o) => _o,
|
||||||
};
|
Err(e) => eprintln!("{}", e),
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Its a post
|
// Its a post
|
||||||
None => {
|
None => {
|
||||||
let parent_user = User_::read(&conn, post.creator_id)?;
|
if post.creator_id != user_id {
|
||||||
if parent_user.send_notifications_to_email {
|
let parent_user = User_::read(&conn, post.creator_id)?;
|
||||||
if let Some(post_reply_email) = parent_user.email {
|
if parent_user.send_notifications_to_email {
|
||||||
let subject = &format!(
|
if let Some(post_reply_email) = parent_user.email {
|
||||||
"{} - Reply from {}",
|
let subject = &format!(
|
||||||
Settings::get().hostname,
|
"{} - Reply from {}",
|
||||||
claims.username
|
Settings::get().hostname,
|
||||||
);
|
claims.username
|
||||||
let html = &format!(
|
);
|
||||||
"<h1>Post Reply</h1><br><div>{} - {}</div><br><a href={}/inbox>inbox</a>",
|
let html = &format!(
|
||||||
claims.username, comment_form.content, hostname
|
"<h1>Post Reply</h1><br><div>{} - {}</div><br><a href={}/inbox>inbox</a>",
|
||||||
);
|
claims.username, comment_form.content, hostname
|
||||||
match send_email(subject, &post_reply_email, &parent_user.name, html) {
|
);
|
||||||
Ok(_o) => _o,
|
match send_email(subject, &post_reply_email, &parent_user.name, html) {
|
||||||
Err(e) => eprintln!("{}", e),
|
Ok(_o) => _o,
|
||||||
};
|
Err(e) => eprintln!("{}", e),
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue