Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F17840659
D19995.id47729.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Referenced Files
None
Subscribers
None
D19995.id47729.diff
View Options
diff --git a/src/applications/people/controller/PhabricatorPeopleWelcomeController.php b/src/applications/people/controller/PhabricatorPeopleWelcomeController.php
--- a/src/applications/people/controller/PhabricatorPeopleWelcomeController.php
+++ b/src/applications/people/controller/PhabricatorPeopleWelcomeController.php
@@ -48,6 +48,20 @@
return id(new AphrontRedirectResponse())->setURI($profile_uri);
}
+ $default_message = PhabricatorAuthMessage::loadMessageText(
+ $admin,
+ PhabricatorAuthWelcomeMailMessageType::MESSAGEKEY);
+ if (strlen($default_message)) {
+ $message_instructions = pht(
+ 'The email will identify you as the sender. You may optionally '.
+ 'replace the customized part of the mail body with different text '.
+ 'by providing a message below.');
+ } else {
+ $message_instructions = pht(
+ 'The email will identify you as the sender. You may optionally '.
+ 'include additional text in the mail body by specifying it below.');
+ }
+
$form = id(new AphrontFormView())
->setViewer($admin)
->appendInstructions(
@@ -62,12 +76,9 @@
'to their account. This link bypasses authentication requirements '.
'and allows them to log in without credentials. Sending a copy of '.
'this email can be useful if the original was lost or never sent.'))
- ->appendInstructions(
- pht(
- 'The email will identify you as the sender. You may optionally '.
- 'include additional text in the mail body by specifying it below.'))
+ ->appendInstructions($message_instructions)
->appendControl(
- id(new AphrontFormTextAreaControl())
+ id(new PhabricatorRemarkupControl())
->setName('message')
->setLabel(pht('Custom Message'))
->setValue($v_message));
diff --git a/src/applications/people/mail/PhabricatorPeopleMailEngine.php b/src/applications/people/mail/PhabricatorPeopleMailEngine.php
--- a/src/applications/people/mail/PhabricatorPeopleMailEngine.php
+++ b/src/applications/people/mail/PhabricatorPeopleMailEngine.php
@@ -58,4 +58,15 @@
throw new PhabricatorPeopleMailEngineException($title, $body);
}
+ final protected function newRemarkupText($text) {
+ $recipient = $this->getRecipient();
+
+ $engine = PhabricatorMarkupEngine::newMarkupEngine(array())
+ ->setConfig('viewer', $recipient)
+ ->setConfig('uri.base', PhabricatorEnv::getProductionURI('/'))
+ ->setMode(PhutilRemarkupEngine::MODE_TEXT);
+
+ return $engine->markupText($text);
+ }
+
}
diff --git a/src/applications/people/mail/PhabricatorPeopleWelcomeMailEngine.php b/src/applications/people/mail/PhabricatorPeopleWelcomeMailEngine.php
--- a/src/applications/people/mail/PhabricatorPeopleWelcomeMailEngine.php
+++ b/src/applications/people/mail/PhabricatorPeopleWelcomeMailEngine.php
@@ -49,9 +49,6 @@
$sender = $this->getSender();
$recipient = $this->getRecipient();
- $recipient_username = $recipient->getUserName();
- $is_serious = PhabricatorEnv::getEnvConfig('phabricator.serious-business');
-
$base_uri = PhabricatorEnv::getProductionURI('/');
$engine = new PhabricatorAuthSessionEngine();
@@ -99,13 +96,9 @@
$message[] = pht(' %s', $base_uri);
}
- $custom_body = $this->getWelcomeMessage();
- if (strlen($custom_body)) {
- $message[] = $custom_body;
- } else {
- if (!$is_serious) {
- $message[] = pht("Love,\nPhabricator");
- }
+ $message_body = $this->newBody();
+ if ($message_body !== null) {
+ $message[] = $message_body;
}
$message = implode("\n\n", $message);
@@ -116,4 +109,27 @@
->setBody($message);
}
+ private function newBody() {
+ $recipient = $this->getRecipient();
+
+ $custom_body = $this->getWelcomeMessage();
+ if (strlen($custom_body)) {
+ return $this->newRemarkupText($custom_body);
+ }
+
+ $default_body = PhabricatorAuthMessage::loadMessageText(
+ $recipient,
+ PhabricatorAuthWelcomeMailMessageType::MESSAGEKEY);
+ if (strlen($default_body)) {
+ return $this->newRemarkupText($default_body);
+ }
+
+ $is_serious = PhabricatorEnv::getEnvConfig('phabricator.serious-business');
+ if (!$is_serious) {
+ return pht("Love,\nPhabricator");
+ }
+
+ return null;
+ }
+
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Jul 27, 9:24 PM (1 w, 2 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
8663403
Default Alt Text
D19995.id47729.diff (4 KB)
Attached To
Mode
D19995: Use the customizable "Welcome Mail" message in welcome mail
Attached
Detach File
Event Timeline
Log In to Comment