1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-15 19:32:40 +01:00
phorge-phorge/src/applications/people/controller/PhabricatorPeopleWelcomeController.php
epriestley 1df9a6e6b0 Move "Send Welcome Email" to profiles and nuke old weird edit UI
Summary: Ref T4065. Moves the last of the weird alternate edit UI to profiles. The old "Edit" controller is now for creation only, and the funky pencil icon is gone.

Test Plan: Created accounts; sent welcome email.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T4065

Differential Revision: https://secure.phabricator.com/D8670
2014-04-02 12:06:17 -07:00

50 lines
1.4 KiB
PHP

<?php
final class PhabricatorPeopleWelcomeController
extends PhabricatorPeopleController {
private $id;
public function willProcessRequest(array $data) {
$this->id = $data['id'];
}
public function processRequest() {
$request = $this->getRequest();
$admin = $request->getUser();
$user = id(new PhabricatorPeopleQuery())
->setViewer($admin)
->withIDs(array($this->id))
->executeOne();
if (!$user) {
return new Aphront404Response();
}
$profile_uri = '/p/'.$user->getUsername().'/';
if ($request->isFormPost()) {
$user->sendWelcomeEmail($admin);
return id(new AphrontRedirectResponse())->setURI($profile_uri);
}
return $this->newDialog()
->setTitle(pht('Send Welcome Email'))
->appendParagraph(
pht(
'This will send the user another copy of the "Welcome to '.
'Phabricator" email that users normally receive when their '.
'accounts are created.'))
->appendParagraph(
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.'))
->addSubmitButton(pht('Send Email'))
->addCancelButton($profile_uri);
}
}