Changeset View
Changeset View
Standalone View
Standalone View
src/applications/audit/editor/PhabricatorAuditEditor.php
Show First 20 Lines • Show All 613 Lines • ▼ Show 20 Lines | protected function buildMailBody( | ||||
if ($inlines) { | if ($inlines) { | ||||
$body->addTextSection( | $body->addTextSection( | ||||
pht('INLINE COMMENTS'), | pht('INLINE COMMENTS'), | ||||
$this->renderInlineCommentsForMail($object, $inlines)); | $this->renderInlineCommentsForMail($object, $inlines)); | ||||
} | } | ||||
if ($is_commit) { | if ($is_commit) { | ||||
$data = $object->getCommitData(); | $data = $object->getCommitData(); | ||||
$this->showMergedCommits($body, $object); | |||||
$body->addTextSection(pht('AFFECTED FILES'), $this->affectedFiles); | $body->addTextSection(pht('AFFECTED FILES'), $this->affectedFiles); | ||||
$this->inlinePatch( | $this->inlinePatch( | ||||
$body, | $body, | ||||
$object); | $object); | ||||
} | } | ||||
// Reload the commit to pull commit data. | // Reload the commit to pull commit data. | ||||
$commit = id(new DiffusionCommitQuery()) | $commit = id(new DiffusionCommitQuery()) | ||||
▲ Show 20 Lines • Show All 50 Lines • ▼ Show 20 Lines | protected function buildMailBody( | ||||
$body->addLinkSection( | $body->addLinkSection( | ||||
pht('COMMIT'), | pht('COMMIT'), | ||||
PhabricatorEnv::getProductionURI('/'.$monogram)); | PhabricatorEnv::getProductionURI('/'.$monogram)); | ||||
return $body; | return $body; | ||||
} | } | ||||
private function showMergedCommits( | |||||
PhabricatorMetaMTAMailBody $body, | |||||
PhabricatorRepositoryCommit $commit) { | |||||
// Get all the merged commits if this one is a merge | |||||
$merges_caption = ''; | |||||
$limit = 50; | |||||
try { | |||||
$drequest = DiffusionRequest::newFromDictionary( | |||||
array( | |||||
'user' => PhabricatorUser::getOmnipotentUser(), | |||||
'initFromConduit' => false, | |||||
'repository' => $commit->getRepository(), | |||||
'commit' => $commit->getCommitIdentifier(), | |||||
)); | |||||
$merges = DiffusionQuery::callConduitWithDiffusionRequest( | |||||
PhabricatorUser::getOmnipotentUser(), | |||||
$drequest, | |||||
'diffusion.mergedcommitsquery', | |||||
array( | |||||
'commit' => $commit->getCommitIdentifier(), | |||||
'limit' => $limit + 1,)); | |||||
if (count($merges) > $limit) { | |||||
$merges = array_slice($merges, 0, $limit); | |||||
$merges_caption = | |||||
"This commit merges more than {$limit} changes. Only the first ". | |||||
"{$limit} are shown.\n"; | |||||
} | |||||
if ($merges) { | |||||
for ($i = 0; $i < count($merges); $i++) { | |||||
$merges[$i] = $merges[$i]->getAuthorName(). | |||||
': '. | |||||
$merges[$i]->getSummary(); | |||||
} | |||||
$body->addTextSection( | |||||
pht('MERGED COMMITS'), | |||||
$merges_caption.implode("\n", $merges)); | |||||
} | |||||
} catch (ConduitException $ex) { | |||||
// Log the exception and continue. | |||||
phlog($ex); | |||||
} | |||||
} | |||||
private function attachPatch( | private function attachPatch( | ||||
PhabricatorMetaMTAMail $template, | PhabricatorMetaMTAMail $template, | ||||
PhabricatorRepositoryCommit $commit) { | PhabricatorRepositoryCommit $commit) { | ||||
if (!$this->getRawPatch()) { | if (!$this->getRawPatch()) { | ||||
return; | return; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 225 Lines • Show Last 20 Lines |