1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-01 03:02:43 +01:00
phorge-phorge/src/applications/diffusion/xaction/DiffusionCommitStateTransaction.php
epriestley 97cac83e9b Add a "Needs Verification" state to Audit
Summary:
Fixes T2393. This allows authors to explicitly say "I think I fixed everything, please accept my commit now thank you".

Also improves behavior of "re-accept" and "re-reject" after new auditors you have authority over get added.

Test Plan:
  - Kicked a commit back and forth between an author and auditor by alternately using "Request Verification" and "Raise Concern".
  - Verified it showed up properly in bucketing for both users.
  - Accepted, added a project, accepted again (works now; didn't before).
  - Audited on behalf of projects / packages.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T2393

Differential Revision: https://secure.phabricator.com/D17252
2017-01-25 13:08:59 -08:00

72 lines
2.4 KiB
PHP

<?php
final class DiffusionCommitStateTransaction
extends DiffusionCommitTransactionType {
const TRANSACTIONTYPE = 'diffusion.commit.state';
public function generateNewValue($object, $value) {
// NOTE: This transaction can not be generated or applied normally. It is
// written to the transaction log as a side effect of a state change.
throw new PhutilMethodNotImplementedException();
}
public function getIcon() {
$new = $this->getNewValue();
return PhabricatorAuditCommitStatusConstants::getStatusIcon($new);
}
public function getColor() {
$new = $this->getNewValue();
return PhabricatorAuditCommitStatusConstants::getStatusColor($new);
}
public function getTitle() {
$new = $this->getNewValue();
switch ($new) {
case PhabricatorAuditCommitStatusConstants::NONE:
return pht('This commit no longer requires audit.');
case PhabricatorAuditCommitStatusConstants::NEEDS_AUDIT:
return pht('This commit now requires audit.');
case PhabricatorAuditCommitStatusConstants::CONCERN_RAISED:
return pht('This commit now has outstanding concerns.');
case PhabricatorAuditCommitStatusConstants::NEEDS_VERIFICATION:
return pht('This commit now requires verification by auditors.');
case PhabricatorAuditCommitStatusConstants::FULLY_AUDITED:
return pht('All concerns with this commit have now been addressed.');
}
return null;
}
public function getTitleForFeed() {
$new = $this->getNewValue();
switch ($new) {
case PhabricatorAuditCommitStatusConstants::NONE:
return pht(
'%s no longer requires audit.',
$this->renderObject());
case PhabricatorAuditCommitStatusConstants::NEEDS_AUDIT:
return pht(
'%s now requires audit.',
$this->renderObject());
case PhabricatorAuditCommitStatusConstants::CONCERN_RAISED:
return pht(
'%s now has outstanding concerns.',
$this->renderObject());
case PhabricatorAuditCommitStatusConstants::NEEDS_VERIFICATION:
return pht(
'%s now requires verification by auditors.',
$this->renderObject());
case PhabricatorAuditCommitStatusConstants::FULLY_AUDITED:
return pht(
'All concerns with %s have now been addressed.',
$this->renderObject());
}
return null;
}
}