Use mail templates for invite text

This commit is contained in:
Evan Prodromou 2011-04-18 09:04:11 -04:00
parent 99d538af58
commit 4a8a424bdf
3 changed files with 67 additions and 22 deletions

View File

@ -262,37 +262,30 @@ class InviteAction extends CurrentUserDesignAction
return false; return false;
} }
$confirmUrl = common_local_url('register', array('code' => $invite->code));
$recipients = array($email); $recipients = array($email);
$headers['From'] = mail_notify_from(); $headers['From'] = mail_notify_from();
$headers['To'] = trim($email); $headers['To'] = trim($email);
$headers['Content-Type'] = 'text/html; charset=UTF-8';
// TRANS: Subject for invitation email. Note that 'them' is correct as a gender-neutral // TRANS: Subject for invitation email. Note that 'them' is correct as a gender-neutral
// TRANS: singular 3rd-person pronoun in English. %1$s is the inviting user, $2$s is // TRANS: singular 3rd-person pronoun in English. %1$s is the inviting user, $2$s is
// TRANS: the StatusNet sitename. // TRANS: the StatusNet sitename.
$headers['Subject'] = sprintf(_('%1$s has invited you to join them on %2$s'), $bestname, $sitename); $headers['Subject'] = sprintf(_('%1$s has invited you to join them on %2$s'), $bestname, $sitename);
// TRANS: Body text for invitation email. Note that 'them' is correct as a gender-neutral $title = (empty($personal)) ? 'invite' : 'invitepersonal';
// TRANS: singular 3rd-person pronoun in English. %1$s is the inviting user, %2$s is the
// TRANS: StatusNet sitename, %3$s is the site URL, %4$s is the personal message from the $inviteTemplate = DocFile::fromTitle($title, DocFile::mailPaths());
// TRANS: inviting user, %s%5 a link to the timeline for the inviting user, %s$6 is a link
// TRANS: to register with the StatusNet site. $body = $inviteTemplate->toHTML(array('inviter' => $bestname,
$body = sprintf(_("%1\$s has invited you to join them on %2\$s (%3\$s).\n\n". 'inviteurl' => $profile->profileurl,
"%2\$s is a micro-blogging service that lets you keep up-to-date with people you know and people who interest you.\n\n". 'confirmurl' => $confirmUrl,
"You can also share news about yourself, your thoughts, or your life online with people who know about you. ". 'personal' => $personal));
"It's also great for meeting new people who share your interests.\n\n".
"%1\$s said:\n\n%4\$s\n\n". common_debug('Confirm URL is ' . common_local_url('register', array('code' => $invite->code)));
"You can see %1\$s's profile page on %2\$s here:\n\n".
"%5\$s\n\n".
"If you'd like to try the service, click on the link below to accept the invitation.\n\n".
"%6\$s\n\n".
"If not, you can ignore this message. Thanks for your patience and your time.\n\n".
"Sincerely, %2\$s\n"),
$bestname,
$sitename,
common_root_url(),
$personal,
common_local_url('showstream', array('nickname' => $user->nickname)),
common_local_url('register', array('code' => $invite->code)));
mail_send($recipients, $headers, $body); mail_send($recipients, $headers, $body);
} }

24
mail-src/invite Normal file
View File

@ -0,0 +1,24 @@
%%arg.inviter%% has invited you to join them on %%site.name%%.
%%site.name%% is a micro-blogging service that lets you keep
up-to-date with people you know and people who interest you.
You can also share news about yourself, your thoughts, or your life
online with people who know about you.
It's great for meeting new people who share your interests.
You can see %%arg.inviter%%'s profile page on %%site.name%% here:
%%arg.inviterurl%%
If you'd like to try the service, click on the link below to accept
the invitation.
%%arg.confirmurl%%
If not, you can ignore this message. Thanks for your patience and your time.
Sincerely,
%%site.name%%

28
mail-src/invitepersonal Normal file
View File

@ -0,0 +1,28 @@
%%arg.inviter%% has invited you to join them on %%site.name%%.
%%site.name%% is a micro-blogging service that lets you keep
up-to-date with people you know and people who interest you.
You can also share news about yourself, your thoughts, or your life
online with people who know about you.
It's great for meeting new people who share your interests.
They said:
%%arg.personal%%
You can see %%arg.inviter%%'s profile page on %%site.name%% here:
%%arg.inviterurl%%
If you'd like to try the service, click on the link below to accept
the invitation.
%%arg.confirmurl%%
If not, you can ignore this message. Thanks for your patience and your time.
Sincerely,
%%site.name%%