1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-22 14:52:41 +01:00

Don't send sandbox URIs in Herald messages.

This commit is contained in:
epriestley 2011-04-04 14:22:16 -07:00
parent d0c9db125b
commit bb79418615
3 changed files with 18 additions and 4 deletions

View file

@ -22,6 +22,11 @@ return array(
// Example: "http://phabricator.example.com/" // Example: "http://phabricator.example.com/"
'phabricator.base-uri' => null, 'phabricator.base-uri' => null,
// If you have multiple environments, provide the production environment URI
// here so that emails, etc., generated in development/sandbox environments
// contain the right links.
'phabricator.production-uri' => null,
// The default PHID for users who haven't uploaded a profile image. It should // The default PHID for users who haven't uploaded a profile image. It should
// be 50x50px. // be 50x50px.
'user.default-profile-image-phid' => 'PHID-FILE-f57aaefce707fc4060ef', 'user.default-profile-image-phid' => 'PHID-FILE-f57aaefce707fc4060ef',

View file

@ -80,9 +80,9 @@ class PhabricatorRepositoryCommitHeraldWorker
$description = $data->getCommitMessage(); $description = $data->getCommitMessage();
$details = PhabricatorEnv::getURI('/'.$commit_name); $details = PhabricatorEnv::getProductionURI('/'.$commit_name);
$differential = $revision $differential = $revision
? PhabricatorEnv::getURI('/D'.$revision->getID()) ? PhabricatorEnv::getProductionURI('/D'.$revision->getID())
: 'No revision.'; : 'No revision.';
$files = $adapter->loadAffectedPaths(); $files = $adapter->loadAffectedPaths();
@ -91,8 +91,9 @@ class PhabricatorRepositoryCommitHeraldWorker
$xscript_id = $xscript->getID(); $xscript_id = $xscript->getID();
$manage_uri = PhabricatorEnv::getURI('/herald/view/commits/'); $manage_uri = PhabricatorEnv::getProductionURI('/herald/view/commits/');
$why_uri = PhabricatorEnv::getURI('/herald/transcript/'.$xscript_id.'/'); $why_uri = PhabricatorEnv::getProductionURI(
'/herald/transcript/'.$xscript_id.'/');
$body = <<<EOBODY $body = <<<EOBODY
DESCRIPTION DESCRIPTION

View file

@ -31,6 +31,14 @@ final class PhabricatorEnv {
return rtrim(self::getEnvConfig('phabricator.base-uri'), '/').$path; return rtrim(self::getEnvConfig('phabricator.base-uri'), '/').$path;
} }
public static function getProductionURI($path) {
$uri = self::getEnvConfig('phabricator.production-uri');
if (!$uri) {
$uri = self::getEnvConfig('phabricator.base-uri');
}
return rtrim($uri, '/').$path;
}
public static function getAllConfigKeys() { public static function getAllConfigKeys() {
return self::$env; return self::$env;
} }