2017-01-11 12:05:31 -08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
final class DiffusionCommitResignTransaction
|
|
|
|
extends DiffusionCommitAuditTransaction {
|
|
|
|
|
|
|
|
const TRANSACTIONTYPE = 'diffusion.commit.resign';
|
|
|
|
const ACTIONKEY = 'resign';
|
|
|
|
|
|
|
|
protected function getCommitActionLabel() {
|
|
|
|
return pht('Resign as Auditor');
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function getCommitActionDescription() {
|
|
|
|
return pht('You will resign as an auditor for this commit.');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getIcon() {
|
|
|
|
return 'fa-flag';
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getColor() {
|
|
|
|
return 'orange';
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function getCommitActionOrder() {
|
|
|
|
return 700;
|
|
|
|
}
|
|
|
|
|
2017-01-12 07:40:48 -08:00
|
|
|
public function getActionName() {
|
|
|
|
return pht('Resigned');
|
|
|
|
}
|
|
|
|
|
2017-01-11 12:05:31 -08:00
|
|
|
public function generateOldValue($object) {
|
|
|
|
$actor = $this->getActor();
|
2017-01-11 15:25:41 -08:00
|
|
|
return !$this->isViewerAnyActiveAuditor($object, $actor);
|
2017-01-11 12:05:31 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
public function applyExternalEffects($object, $value) {
|
|
|
|
$status = PhabricatorAuditStatusConstants::RESIGNED;
|
|
|
|
$actor = $this->getActor();
|
|
|
|
$this->applyAuditorEffect($object, $actor, $value, $status);
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function validateAction($object, PhabricatorUser $viewer) {
|
2017-01-11 15:25:41 -08:00
|
|
|
if (!$this->isViewerAnyActiveAuditor($object, $viewer)) {
|
2017-01-11 12:05:31 -08:00
|
|
|
throw new Exception(
|
|
|
|
pht(
|
|
|
|
'You can not resign from this commit because you are not an '.
|
2017-01-11 15:25:41 -08:00
|
|
|
'active auditor.'));
|
2017-01-11 12:05:31 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getTitle() {
|
|
|
|
return pht(
|
|
|
|
'%s resigned from this commit.',
|
|
|
|
$this->renderAuthor());
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getTitleForFeed() {
|
|
|
|
return pht(
|
|
|
|
'%s resigned from %s.',
|
|
|
|
$this->renderAuthor(),
|
|
|
|
$this->renderObject());
|
|
|
|
}
|
|
|
|
|
2018-10-25 04:58:06 -07:00
|
|
|
public function getTransactionTypeForConduit($xaction) {
|
|
|
|
return 'resign';
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getFieldValuesForConduit($object, $data) {
|
|
|
|
return array();
|
|
|
|
}
|
|
|
|
|
2017-01-11 12:05:31 -08:00
|
|
|
}
|