mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-13 10:22:42 +01:00
611f670720
Summary: Ref T4588. Request from @zeeg. Adds a "BRANCHES" field to commit emails, so the branches the commit appears on are shown. I've implemented this with CustomField, but in a very light way. Test Plan: Used `scripts/repository/reparse.php --herald` to generate mail, got a BRANCHES section where applicable. Reviewers: btrahan Reviewed By: btrahan Subscribers: aran, epriestley, zeeg Maniphest Tasks: T4588 Differential Revision: https://secure.phabricator.com/D8501
37 lines
967 B
PHP
37 lines
967 B
PHP
<?php
|
|
|
|
final class PhabricatorCommitBranchesField
|
|
extends PhabricatorCommitCustomField {
|
|
|
|
public function getFieldKey() {
|
|
return 'diffusion:branches';
|
|
}
|
|
|
|
public function shouldAppearInApplicationTransactions() {
|
|
return true;
|
|
}
|
|
|
|
public function buildApplicationTransactionMailBody(
|
|
PhabricatorApplicationTransaction $xaction,
|
|
PhabricatorMetaMTAMailBody $body) {
|
|
|
|
$params = array(
|
|
'contains' => $this->getObject()->getCommitIdentifier(),
|
|
'callsign' => $this->getObject()->getRepository()->getCallsign(),
|
|
);
|
|
|
|
$branches_raw = id(new ConduitCall('diffusion.branchquery', $params))
|
|
->setUser($this->getViewer())
|
|
->execute();
|
|
|
|
$branches = DiffusionRepositoryRef::loadAllFromDictionaries($branches_raw);
|
|
if (!$branches) {
|
|
return;
|
|
}
|
|
$branch_names = mpull($branches, 'getShortName');
|
|
sort($branch_names);
|
|
|
|
$body->addTextSection(pht('BRANCHES'), implode(', ', $branch_names));
|
|
}
|
|
|
|
}
|