mirror of
https://we.phorge.it/source/phorge.git
synced 2025-02-03 02:18:24 +01:00
82c891f586
Summary: Ref T10978. This prepares for swapping the comment UI to stacked actions. These are only accessible via the API. Test Plan: Used the API to accept, raise concern with, and reject commits. Reviewers: chad Reviewed By: chad Maniphest Tasks: T10978 Differential Revision: https://secure.phabricator.com/D17182
62 lines
1.4 KiB
PHP
62 lines
1.4 KiB
PHP
<?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;
|
|
}
|
|
|
|
public function generateOldValue($object) {
|
|
$actor = $this->getActor();
|
|
return !$this->isViewerAnyAuditor($object, $actor);
|
|
}
|
|
|
|
public function applyExternalEffects($object, $value) {
|
|
$status = PhabricatorAuditStatusConstants::RESIGNED;
|
|
$actor = $this->getActor();
|
|
$this->applyAuditorEffect($object, $actor, $value, $status);
|
|
}
|
|
|
|
protected function validateAction($object, PhabricatorUser $viewer) {
|
|
if (!$this->isViewerAnyAuditor($object, $viewer)) {
|
|
throw new Exception(
|
|
pht(
|
|
'You can not resign from this commit because you are not an '.
|
|
'auditor.'));
|
|
}
|
|
}
|
|
|
|
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());
|
|
}
|
|
|
|
}
|