mirror of
https://we.phorge.it/source/phorge.git
synced 2025-02-23 03:59:25 +01:00
Improve Herald commit emails
Summary: - Show the canonical (i.e., shorter) commit identifier in the subject. - For commits without a revision, put the commit summary in the subject. Test Plan: Ran "scripts/repository/reparse.php <commit> --herald" for a number of different commits (with revision, without revision); got more useful email subjects. Reviewers: btrahan Reviewed By: btrahan CC: aran, epriestley Maniphest Tasks: T1028 Differential Revision: https://secure.phabricator.com/D2004
This commit is contained in:
parent
b9931fa340
commit
2ef3e69e58
1 changed files with 16 additions and 12 deletions
|
@ -64,23 +64,27 @@ final class PhabricatorRepositoryCommitHeraldWorker
|
||||||
|
|
||||||
$xscript = $engine->getTranscript();
|
$xscript = $engine->getTranscript();
|
||||||
|
|
||||||
$commit_name = $adapter->getHeraldName();
|
|
||||||
$revision = $adapter->loadDifferentialRevision();
|
$revision = $adapter->loadDifferentialRevision();
|
||||||
|
|
||||||
$name = null;
|
|
||||||
if ($revision) {
|
if ($revision) {
|
||||||
$name = ' '.$revision->getTitle();
|
$name = $revision->getTitle();
|
||||||
|
} else {
|
||||||
|
$name = $data->getSummary();
|
||||||
}
|
}
|
||||||
|
|
||||||
$author_phid = $data->getCommitDetail('authorPHID');
|
$author_phid = $data->getCommitDetail('authorPHID');
|
||||||
$reviewer_phid = $data->getCommitDetail('reviewerPHID');
|
$reviewer_phid = $data->getCommitDetail('reviewerPHID');
|
||||||
|
|
||||||
$phids = array_filter(array($author_phid, $reviewer_phid));
|
$phids = array_filter(
|
||||||
|
array(
|
||||||
|
$author_phid,
|
||||||
|
$reviewer_phid,
|
||||||
|
$commit->getPHID(),
|
||||||
|
));
|
||||||
|
|
||||||
$handles = array();
|
$handles = id(new PhabricatorObjectHandleData($phids))->loadHandles();
|
||||||
if ($phids) {
|
|
||||||
$handles = id(new PhabricatorObjectHandleData($phids))->loadHandles();
|
$commit_handle = $handles[$commit->getPHID()];
|
||||||
}
|
$commit_name = $commit_handle->getName();
|
||||||
|
|
||||||
if ($author_phid) {
|
if ($author_phid) {
|
||||||
$author_name = $handles[$author_phid]->getName();
|
$author_name = $handles[$author_phid]->getName();
|
||||||
|
@ -98,7 +102,7 @@ final class PhabricatorRepositoryCommitHeraldWorker
|
||||||
|
|
||||||
$description = $data->getCommitMessage();
|
$description = $data->getCommitMessage();
|
||||||
|
|
||||||
$details = PhabricatorEnv::getProductionURI('/'.$commit_name);
|
$commit_uri = PhabricatorEnv::getProductionURI($commit_handle->getURI());
|
||||||
$differential = $revision
|
$differential = $revision
|
||||||
? PhabricatorEnv::getProductionURI('/D'.$revision->getID())
|
? PhabricatorEnv::getProductionURI('/D'.$revision->getID())
|
||||||
: 'No revision.';
|
: 'No revision.';
|
||||||
|
@ -130,7 +134,7 @@ DESCRIPTION
|
||||||
{$description}
|
{$description}
|
||||||
|
|
||||||
DETAILS
|
DETAILS
|
||||||
{$details}
|
{$commit_uri}
|
||||||
|
|
||||||
DIFFERENTIAL REVISION
|
DIFFERENTIAL REVISION
|
||||||
{$differential}
|
{$differential}
|
||||||
|
@ -146,7 +150,7 @@ WHY DID I GET THIS EMAIL?
|
||||||
|
|
||||||
EOBODY;
|
EOBODY;
|
||||||
|
|
||||||
$subject = "[Herald/Commit] {$commit_name} ({$who}){$name}";
|
$subject = "[Herald/Commit] {$commit_name} ({$who}) {$name}";
|
||||||
|
|
||||||
$threading = PhabricatorAuditCommentEditor::getMailThreading(
|
$threading = PhabricatorAuditCommentEditor::getMailThreading(
|
||||||
$commit->getPHID());
|
$commit->getPHID());
|
||||||
|
|
Loading…
Add table
Reference in a new issue