Differential D11736 Diff 28276 src/applications/people/controller/PhabricatorPeopleInviteSendController.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/people/controller/PhabricatorPeopleInviteSendController.php
Show All 38 Lines | if ($request->isFormPost()) { | ||||
$is_confirm = true; | $is_confirm = true; | ||||
$actions = PhabricatorAuthInviteAction::newActionListFromAddresses( | $actions = PhabricatorAuthInviteAction::newActionListFromAddresses( | ||||
$viewer, | $viewer, | ||||
$email_list); | $email_list); | ||||
$any_valid = false; | $any_valid = false; | ||||
$all_valid = true; | $all_valid = true; | ||||
$action_send = PhabricatorAuthInviteAction::ACTION_SEND; | |||||
foreach ($actions as $action) { | foreach ($actions as $action) { | ||||
if ($action->getAction() == $action_send) { | if ($action->willSend()) { | ||||
$any_valid = true; | $any_valid = true; | ||||
} else { | } else { | ||||
$all_valid = false; | $all_valid = false; | ||||
} | } | ||||
} | } | ||||
if (!$any_valid) { | if (!$any_valid) { | ||||
$confirm_errors[] = pht( | $confirm_errors[] = pht( | ||||
Show All 9 Lines | if ($request->isFormPost()) { | ||||
$confirm_errors[] = pht( | $confirm_errors[] = pht( | ||||
'Some of the addresses you entered do not appear to be '. | 'Some of the addresses you entered do not appear to be '. | ||||
'valid recipients. Review the table below. You can revise '. | 'valid recipients. Review the table below. You can revise '. | ||||
'the address list, or ignore these errors and continue.'); | 'the address list, or ignore these errors and continue.'); | ||||
$severity = PHUIErrorView::SEVERITY_WARNING; | $severity = PHUIErrorView::SEVERITY_WARNING; | ||||
} | } | ||||
if ($any_valid && $request->getBool('confirm')) { | if ($any_valid && $request->getBool('confirm')) { | ||||
throw new Exception( | |||||
pht('TODO: This workflow is not yet fully implemented.')); | // TODO: The copywriting on this mail could probably be more | ||||
// engaging and we could have a fancy HTML version. | |||||
$template = array(); | |||||
$template[] = pht( | |||||
'%s has invited you to join Phabricator.', | |||||
$viewer->getFullName()); | |||||
if (strlen(trim($message))) { | |||||
$template[] = $message; | |||||
} | |||||
$template[] = pht( | |||||
'To register an account and get started, follow this link:'); | |||||
// This isn't a variable; it will be replaced later on in the | |||||
// daemons once they generate the URI. | |||||
$template[] = '{$INVITE_URI}'; | |||||
$template[] = pht( | |||||
'If you already have an account, you can follow the link to '. | |||||
'quickly verify this email address.'); | |||||
$template = implode("\n\n", $template); | |||||
foreach ($actions as $action) { | |||||
if ($action->willSend()) { | |||||
$action->sendInvite($viewer, $template); | |||||
} | |||||
} | |||||
// TODO: This is a bit anticlimactic. We don't really have anything | |||||
// to show the user because the action is happening in the background | |||||
// and the invites won't exist yet. After T5166 we can show a | |||||
// better progress bar. | |||||
return id(new AphrontRedirectResponse()) | |||||
->setURI($this->getApplicationURI()); | |||||
} | } | ||||
} | } | ||||
} | } | ||||
if ($is_confirm) { | if ($is_confirm) { | ||||
$title = pht('Confirm Invites'); | $title = pht('Confirm Invites'); | ||||
} else { | } else { | ||||
$title = pht('Invite Users'); | $title = pht('Invite Users'); | ||||
▲ Show 20 Lines • Show All 101 Lines • Show Last 20 Lines |