Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve email notification text #5321

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 24 additions & 4 deletions crates/api_common/src/build_response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ pub async fn send_local_notifs(
local_user_view: Option<&LocalUserView>,
) -> LemmyResult<Vec<LocalUserId>> {
let mut recipient_ids = Vec::new();
let inbox_link = format!("{}/inbox", context.settings().get_protocol_and_hostname());

// When called from api code, we have local user view and can read with CommentView
// to reduce db queries. But when receiving a federated comment the user view is None,
Expand All @@ -126,6 +125,14 @@ pub async fn send_local_notifs(
(comment, post, community)
};

let inbox_link = format!("{}/inbox", context.settings().get_protocol_and_hostname());
let comment_link = format!(
"{}/post/{}/{}",
context.settings().get_protocol_and_hostname(),
post.id,
comment_id
);

// Send the local mentions
for mention in mentions
.iter()
Expand Down Expand Up @@ -159,7 +166,7 @@ pub async fn send_local_notifs(
send_email_to_user(
&mention_user_view,
&lang.notification_mentioned_by_subject(&person.name),
&lang.notification_mentioned_by_body(&content, &inbox_link, &person.name),
&lang.notification_mentioned_by_body(&comment_link, &content, &inbox_link, &person.name),
context.settings(),
)
.await
Expand Down Expand Up @@ -211,7 +218,14 @@ pub async fn send_local_notifs(
send_email_to_user(
&parent_user_view,
&lang.notification_comment_reply_subject(&person.name),
&lang.notification_comment_reply_body(&content, &inbox_link, &person.name),
&lang.notification_comment_reply_body(
&comment_link,
&content,
&inbox_link,
&parent_comment.content,
&post.name,
&person.name,
),
context.settings(),
)
.await
Expand Down Expand Up @@ -257,7 +271,13 @@ pub async fn send_local_notifs(
send_email_to_user(
&parent_user_view,
&lang.notification_post_reply_subject(&person.name),
&lang.notification_post_reply_body(&content, &inbox_link, &person.name),
&lang.notification_post_reply_body(
&comment_link,
&content,
&inbox_link,
&post.name,
&person.name,
),
context.settings(),
)
.await
Expand Down
2 changes: 1 addition & 1 deletion crates/utils/translations
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am assuming I should change this to reference the commit that actually changes en.json once 154 is merged.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesnt really matter, it gets updated to the latest commit automatically with each release. You only need to get the CI checks passing.