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 the email template (plain-text edition) #321

Open
wants to merge 2 commits into
base: master
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
22 changes: 18 additions & 4 deletions backend/classes/writecomments.php
Original file line number Diff line number Diff line change
Expand Up @@ -656,8 +656,17 @@ protected function sendNotifications ($file)
// Get comment permalink
$permalink = $this->filePermalink ($file);

// "New Comment" locale string
$new_comment = $this->locale->text['new-comment'];
// "New comment on “<thread title>”" locale string
$new_comment = sprintf ($this->locale->text['new-comment'], $this->setup->pageTitle)

// "Hi" locale string
$email_greeting = $this->locale->text['email-greeting'];

// "“<poster name>” has posted a new comment on a discussion you’re following:" locale string
$email_explainer = sprintf ($this->locale->text['email-explainer'], $name);

// "Jump back into the discussion at:" (link) locale string
$email_call_to_action = $this->locale->text['email-call-to-action'];

// E-mail hash for Gravatar or empty for default avatar
$hash = Misc::getArrayItem ($this->data, 'email_hash') ?: '';
Expand Down Expand Up @@ -691,6 +700,11 @@ protected function sendNotifications ($file)
$data['page'] = $this->locale->text['page'];
$data['new-comment'] = $new_comment;

// Add email template strings to data
$data['email-greeting'] = $email_greeting;
$data['email-explainer'] = $email_explainer;
$data['email-call-to-action'] = $email_call_to_action;

// Add comment permalink to data
$data['permalink'] = $this->setup->pageURL . '#' . $permalink;

Expand Down Expand Up @@ -729,8 +743,8 @@ protected function sendNotifications ($file)
// Get and parse plain text e-mail notification
$text_body = $this->templater->parseTheme ('email-notification.txt', $data);

// Set subject to "New Comment - <domain here>"
$this->mail->subject ($new_comment . ' - ' . $domain);
// Set subject to "New comment on “<thread title>”"
$this->mail->subject ($new_comment);

// Set plain text version of the message
$this->mail->text ($text_body);
Expand Down
6 changes: 5 additions & 1 deletion backend/locales/en-us.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,14 +124,18 @@
'hashover-comments' => 'HashOver Comments',
'rss-feed' => 'RSS Feed',
'source-code' => 'Source Code',
'new-comment' => 'New Comment',
'new-comment' => 'New comment on “%s”',
'from' => 'From %s',
'comment' => 'Comment',
'page' => 'Page',
'sent-by' => 'This e-mail was sent by %s via HashOver.',
'enabled' => 'Enabled',
'disabled' => 'Disabled',

'email-greeting' => 'Hi!',
'email-explainer' => '“%s” has posted a new comment on a discussion you’re following:',
'email-call-to-action' => 'Jump back into the discussion at:',

'source-code-sub' => 'HashOver server-side source code viewer',
'type' => 'Type',
'path' => 'Path',
Expand Down
13 changes: 6 additions & 7 deletions themes/default/email-notification.txt
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
{from}
{email-greeting}

{email-explainer}

{text-comment}

{in-reply-to}

{text-reply}

----

{comment}: {permalink}

{page}: {url}

----
{email-call-to-action}
{permalink}

--
{sent-by}