3 final class DiffusionCommitStateTransaction
4 extends DiffusionCommitTransactionType
{
6 const TRANSACTIONTYPE
= 'diffusion.commit.state';
8 public function generateNewValue($object, $value) {
9 // NOTE: This transaction can not be generated or applied normally. It is
10 // written to the transaction log as a side effect of a state change.
11 throw new PhutilMethodNotImplementedException();
14 private function getAuditStatusObject() {
15 $new = $this->getNewValue();
16 return DiffusionCommitAuditStatus
::newForStatus($new);
19 public function getIcon() {
20 return $this->getAuditStatusObject()->getIcon();
23 public function getColor() {
24 return $this->getAuditStatusObject()->getColor();
27 public function getTitle() {
28 $status = $this->getAuditStatusObject();
30 switch ($status->getKey()) {
31 case DiffusionCommitAuditStatus
::NONE
:
32 return pht('This commit no longer requires audit.');
33 case DiffusionCommitAuditStatus
::NEEDS_AUDIT
:
34 return pht('This commit now requires audit.');
35 case DiffusionCommitAuditStatus
::CONCERN_RAISED
:
36 return pht('This commit now has outstanding concerns.');
37 case DiffusionCommitAuditStatus
::NEEDS_VERIFICATION
:
38 return pht('This commit now requires verification by auditors.');
39 case DiffusionCommitAuditStatus
::AUDITED
:
40 return pht('All concerns with this commit have now been addressed.');
46 public function getTitleForFeed() {
47 $status = $this->getAuditStatusObject();
49 switch ($status->getKey()) {
50 case DiffusionCommitAuditStatus
::NONE
:
52 '%s no longer requires audit.',
53 $this->renderObject());
54 case DiffusionCommitAuditStatus
::NEEDS_AUDIT
:
56 '%s now requires audit.',
57 $this->renderObject());
58 case DiffusionCommitAuditStatus
::CONCERN_RAISED
:
60 '%s now has outstanding concerns.',
61 $this->renderObject());
62 case DiffusionCommitAuditStatus
::NEEDS_VERIFICATION
:
64 '%s now requires verification by auditors.',
65 $this->renderObject());
66 case DiffusionCommitAuditStatus
::AUDITED
:
68 'All concerns with %s have now been addressed.',
69 $this->renderObject());