mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-16 20:02:40 +01:00
cf6f7446ce
Summary: Ref T418. Fixes T4642. The "changes since last update" and "branch" fields got dropped; restore them in a general, field-driven way. Test Plan: - Created a revision, got relevant sections in mail. - Commented on a revision, got relevant sections in mail. - Updated a revision, got relevant sections in mail. Reviewers: btrahan Reviewed By: btrahan Subscribers: spicyj, epriestley Maniphest Tasks: T418, T4642 Differential Revision: https://secure.phabricator.com/D8657
60 lines
1.4 KiB
PHP
60 lines
1.4 KiB
PHP
<?php
|
|
|
|
final class DifferentialChangesSinceLastUpdateField
|
|
extends DifferentialCustomField {
|
|
|
|
public function getFieldKey() {
|
|
return 'differential:changes-since-last-update';
|
|
}
|
|
|
|
public function getFieldName() {
|
|
return pht('Changes Since Last Update');
|
|
}
|
|
|
|
public function getFieldDescription() {
|
|
return pht('Links to changes since the last update in email.');
|
|
}
|
|
|
|
public function shouldAppearInTransactionMail() {
|
|
return true;
|
|
}
|
|
|
|
public function updateTransactionMailBody(
|
|
PhabricatorMetaMTAMailBody $body,
|
|
PhabricatorApplicationTransactionEditor $editor,
|
|
array $xactions) {
|
|
|
|
if ($editor->getIsNewObject()) {
|
|
return;
|
|
}
|
|
|
|
if ($editor->getIsCloseByCommit()) {
|
|
return;
|
|
}
|
|
|
|
$xaction = $editor->getDiffUpdateTransaction($xactions);
|
|
if (!$xaction) {
|
|
return;
|
|
}
|
|
|
|
$original = id(new DifferentialDiffQuery())
|
|
->setViewer($this->getViewer())
|
|
->withPHIDs(array($xaction->getOldValue()))
|
|
->executeOne();
|
|
if (!$original) {
|
|
return;
|
|
}
|
|
|
|
$revision = $this->getObject();
|
|
$current = $revision->getActiveDiff();
|
|
|
|
$old_id = $original->getID();
|
|
$new_id = $current->getID();
|
|
|
|
$uri = '/'.$revision->getMonogram().'?vs='.$old_id.'&id='.$new_id;
|
|
$uri = PhabricatorEnv::getProductionURI($uri);
|
|
|
|
$body->addTextSection(pht('CHANGES SINCE LAST UPDATE'), $uri);
|
|
}
|
|
|
|
}
|