Changeset View
Changeset View
Standalone View
Standalone View
src/applications/people/mail/PhabricatorPeopleWelcomeMailEngine.php
| Show First 20 Lines • Show All 43 Lines • ▼ Show 20 Lines | if (!$recipient->canEstablishWebSessions()) { | ||||
| 'web sessions.')); | 'web sessions.')); | ||||
| } | } | ||||
| } | } | ||||
| protected function newMail() { | protected function newMail() { | ||||
| $sender = $this->getSender(); | $sender = $this->getSender(); | ||||
| $recipient = $this->getRecipient(); | $recipient = $this->getRecipient(); | ||||
| $recipient_username = $recipient->getUserName(); | |||||
| $is_serious = PhabricatorEnv::getEnvConfig('phabricator.serious-business'); | |||||
| $base_uri = PhabricatorEnv::getProductionURI('/'); | $base_uri = PhabricatorEnv::getProductionURI('/'); | ||||
| $engine = new PhabricatorAuthSessionEngine(); | $engine = new PhabricatorAuthSessionEngine(); | ||||
| $uri = $engine->getOneTimeLoginURI( | $uri = $engine->getOneTimeLoginURI( | ||||
| $recipient, | $recipient, | ||||
| $recipient->loadPrimaryEmail(), | $recipient->loadPrimaryEmail(), | ||||
| PhabricatorAuthSessionEngine::ONETIME_WELCOME); | PhabricatorAuthSessionEngine::ONETIME_WELCOME); | ||||
| Show All 31 Lines | if ($use_passwords) { | ||||
| 'To log in to your account for the first time, follow this link:'); | 'To log in to your account for the first time, follow this link:'); | ||||
| $message[] = pht(' %s', $uri); | $message[] = pht(' %s', $uri); | ||||
| $message[] = pht( | $message[] = pht( | ||||
| 'After you set up your account, you can log in to Phabricator in '. | 'After you set up your account, you can log in to Phabricator in '. | ||||
| 'the future by going here:'); | 'the future by going here:'); | ||||
| $message[] = pht(' %s', $base_uri); | $message[] = pht(' %s', $base_uri); | ||||
| } | } | ||||
| $custom_body = $this->getWelcomeMessage(); | $message_body = $this->newBody(); | ||||
| if (strlen($custom_body)) { | if ($message_body !== null) { | ||||
| $message[] = $custom_body; | $message[] = $message_body; | ||||
| } else { | |||||
| if (!$is_serious) { | |||||
| $message[] = pht("Love,\nPhabricator"); | |||||
| } | |||||
| } | } | ||||
| $message = implode("\n\n", $message); | $message = implode("\n\n", $message); | ||||
| return id(new PhabricatorMetaMTAMail()) | return id(new PhabricatorMetaMTAMail()) | ||||
| ->addTos(array($recipient->getPHID())) | ->addTos(array($recipient->getPHID())) | ||||
| ->setSubject(pht('[Phabricator] Welcome to Phabricator')) | ->setSubject(pht('[Phabricator] Welcome to Phabricator')) | ||||
| ->setBody($message); | ->setBody($message); | ||||
| } | } | ||||
| private function newBody() { | |||||
| $recipient = $this->getRecipient(); | |||||
| $custom_body = $this->getWelcomeMessage(); | |||||
| if (strlen($custom_body)) { | |||||
| return $this->newRemarkupText($custom_body); | |||||
| } | |||||
| $default_body = PhabricatorAuthMessage::loadMessageText( | |||||
| $recipient, | |||||
| PhabricatorAuthWelcomeMailMessageType::MESSAGEKEY); | |||||
| if (strlen($default_body)) { | |||||
| return $this->newRemarkupText($default_body); | |||||
| } | |||||
| $is_serious = PhabricatorEnv::getEnvConfig('phabricator.serious-business'); | |||||
| if (!$is_serious) { | |||||
| return pht("Love,\nPhabricator"); | |||||
| } | |||||
| return null; | |||||
| } | |||||
| } | } | ||||