Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14013037
D14134.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D14134.diff
View Options
diff --git a/src/applications/people/controller/PhabricatorPeopleProfileController.php b/src/applications/people/controller/PhabricatorPeopleProfileController.php
--- a/src/applications/people/controller/PhabricatorPeopleProfileController.php
+++ b/src/applications/people/controller/PhabricatorPeopleProfileController.php
@@ -136,11 +136,14 @@
->setWorkflow(true)
->setHref($this->getApplicationURI('delete/'.$user->getID().'/')));
+ $can_welcome = $user->canEstablishWebSessions();
+
$actions->addAction(
id(new PhabricatorActionView())
->setIcon('fa-envelope')
->setName(pht('Send Welcome Email'))
->setWorkflow(true)
+ ->setDisabled(!$can_welcome)
->setHref($this->getApplicationURI('welcome/'.$user->getID().'/')));
}
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
@@ -3,19 +3,12 @@
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();
+ public function handleRequest(AphrontRequest $request) {
+ $admin = $this->getViewer();
$user = id(new PhabricatorPeopleQuery())
->setViewer($admin)
- ->withIDs(array($this->id))
+ ->withIDs(array($request->getURIData('id')))
->executeOne();
if (!$user) {
return new Aphront404Response();
@@ -23,6 +16,18 @@
$profile_uri = '/p/'.$user->getUsername().'/';
+ if (!$user->canEstablishWebSessions()) {
+ return $this->newDialog()
+ ->setTitle(pht('Not a Normal User'))
+ ->appendParagraph(
+ pht(
+ 'You can not send this user a welcome mail because they are not '.
+ 'a normal user and can not log in to the web interface. Special '.
+ 'users (like bots and mailing lists) are unable to establish web '.
+ 'sessions.'))
+ ->addCancelButton($profile_uri, pht('Done'));
+ }
+
if ($request->isFormPost()) {
$user->sendWelcomeEmail($admin);
return id(new AphrontRedirectResponse())->setURI($profile_uri);
diff --git a/src/applications/people/storage/PhabricatorUser.php b/src/applications/people/storage/PhabricatorUser.php
--- a/src/applications/people/storage/PhabricatorUser.php
+++ b/src/applications/people/storage/PhabricatorUser.php
@@ -587,6 +587,13 @@
}
public function sendWelcomeEmail(PhabricatorUser $admin) {
+ if (!$this->canEstablishWebSessions()) {
+ throw new Exception(
+ pht(
+ 'Can not send welcome mail to users who can not establish '.
+ 'web sessions!'));
+ }
+
$admin_username = $admin->getUserName();
$admin_realname = $admin->getRealName();
$user_username = $this->getUserName();
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 2, 11:36 PM (2 w, 2 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6733321
Default Alt Text
D14134.diff (3 KB)
Attached To
Mode
D14134: Don't allow welcome mail to be sent to users who can't login
Attached
Detach File
Event Timeline
Log In to Comment