Move "Welcome" mail generation out of PhabricatorUser
Summary: Ref PHI1027. Currently, `PhabricatorUser` has a couple of mail-related methods which shouldn't really be there in the long term. Immediately, I want to make some adjusments to the welcome email. Move "Welcome" mail generation to a separate class and consolidate all the error handling. (Eventually, "invite" and "verify address" email should move to similar subclasses, too.) Previously, a bunch of errors/conditions got checked in multiple places. The only functional change is that we no longer allow you to send welcome mail to disabled users. Test Plan: - Used "Send Welcome Mail" from profile pages to send mail. - Hit "not admin", "disabled user", "bot/mailing list" errors. - Used `scripts/user/add_user.php` to send welcome mail. - Used "Create New User" to send welcome mail. - Verified mail with `bin/mail show-outbound`. (Cleaned up a couple of minor display issues here.) Reviewers: amckinley Reviewed By: amckinley Differential Revision: https://secure.phabricator.com/D19989
This commit is contained in:
@@ -59,7 +59,12 @@ id(new PhabricatorUserEditor())
|
||||
->setActor($admin)
|
||||
->createNewUser($user, $email_object);
|
||||
|
||||
$user->sendWelcomeEmail($admin);
|
||||
$welcome_engine = id(new PhabricatorPeopleWelcomeMailEngine())
|
||||
->setSender($admin)
|
||||
->setRecipient($user);
|
||||
if ($welcome_engine->canSendMail()) {
|
||||
$welcome_engine->sendMail();
|
||||
}
|
||||
|
||||
echo pht(
|
||||
"Created user '%s' (realname='%s', email='%s').\n",
|
||||
|
||||
Reference in New Issue
Block a user