Page MenuHomePhabricator

D19991.id47725.diff
No OneTemporary

D19991.id47725.diff

diff --git a/src/applications/people/controller/PhabricatorPeopleProfileManageController.php b/src/applications/people/controller/PhabricatorPeopleProfileManageController.php
--- a/src/applications/people/controller/PhabricatorPeopleProfileManageController.php
+++ b/src/applications/people/controller/PhabricatorPeopleProfileManageController.php
@@ -155,6 +155,18 @@
$disable_name = pht('Disable User');
}
+ $curtain->addAction(
+ id(new PhabricatorActionView())
+ ->setIcon('fa-envelope')
+ ->setName(pht('Send Welcome Email'))
+ ->setWorkflow(true)
+ ->setDisabled(!$can_welcome)
+ ->setHref($this->getApplicationURI('welcome/'.$user->getID().'/')));
+
+ $curtain->addAction(
+ id(new PhabricatorActionView())
+ ->setType(PhabricatorActionView::TYPE_DIVIDER));
+
$curtain->addAction(
id(new PhabricatorActionView())
->setIcon($disable_icon)
@@ -173,11 +185,7 @@
$curtain->addAction(
id(new PhabricatorActionView())
- ->setIcon('fa-envelope')
- ->setName(pht('Send Welcome Email'))
- ->setWorkflow(true)
- ->setDisabled(!$can_welcome)
- ->setHref($this->getApplicationURI('welcome/'.$user->getID().'/')));
+ ->setType(PhabricatorActionView::TYPE_DIVIDER));
return $curtain;
}
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
@@ -37,24 +37,45 @@
->addCancelButton($profile_uri, pht('Done'));
}
+ $v_message = $request->getStr('message');
+
if ($request->isFormPost()) {
+ if (strlen($v_message)) {
+ $welcome_engine->setWelcomeMessage($v_message);
+ }
+
$welcome_engine->sendMail();
return id(new AphrontRedirectResponse())->setURI($profile_uri);
}
- return $this->newDialog()
- ->setTitle(pht('Send Welcome Email'))
- ->appendParagraph(
+ $form = id(new AphrontFormView())
+ ->setViewer($admin)
+ ->appendInstructions(
pht(
- 'This will send the user another copy of the "Welcome to '.
+ 'This workflow will send this user ("%s") a copy of the "Welcome to '.
'Phabricator" email that users normally receive when their '.
- 'accounts are created.'))
- ->appendParagraph(
+ 'accounts are created by an administrator.',
+ $user->getUsername()))
+ ->appendInstructions(
pht(
- 'The email contains a link to log in to their account. Sending '.
- 'another copy of the email can be useful if the original was lost '.
- 'or never sent.'))
- ->appendParagraph(pht('The email will identify you as the sender.'))
+ 'The email will contain a link that the user may use to log in '.
+ '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.'))
+ ->appendControl(
+ id(new AphrontFormTextAreaControl())
+ ->setName('message')
+ ->setLabel(pht('Custom Message'))
+ ->setValue($v_message));
+
+ return $this->newDialog()
+ ->setTitle(pht('Send Welcome Email'))
+ ->setWidth(AphrontDialogView::WIDTH_FORM)
+ ->appendForm($form)
->addSubmitButton(pht('Send Email'))
->addCancelButton($profile_uri);
}
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
@@ -3,6 +3,17 @@
final class PhabricatorPeopleWelcomeMailEngine
extends PhabricatorPeopleMailEngine {
+ private $welcomeMessage;
+
+ public function setWelcomeMessage($welcome_message) {
+ $this->welcomeMessage = $welcome_message;
+ return $this;
+ }
+
+ public function getWelcomeMessage() {
+ return $this->welcomeMessage;
+ }
+
public function validateMail() {
$sender = $this->getSender();
$recipient = $this->getRecipient();
@@ -88,8 +99,13 @@
$message[] = pht(' %s', $base_uri);
}
- if (!$is_serious) {
- $message[] = pht("Love,\nPhabricator");
+ $custom_body = $this->getWelcomeMessage();
+ if (strlen($custom_body)) {
+ $message[] = $custom_body;
+ } else {
+ if (!$is_serious) {
+ $message[] = pht("Love,\nPhabricator");
+ }
}
$message = implode("\n\n", $message);

File Metadata

Mime Type
text/plain
Expires
Wed, Mar 5, 11:04 AM (1 w, 6 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7225262
Default Alt Text
D19991.id47725.diff (4 KB)

Event Timeline