1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-10 06:41:04 +01:00
phorge-phorge/src/applications/differential/constants/DifferentialReviewerStatus.php
epriestley 5a6643f36f Restore "Accept", "Reject" and "Resign" actions to Differential on EditEngine
Summary:
Ref T11114. Some rough edges, but this largely makes Accept, Reject and Resign work in the new EditEngine comment area.

Ref T11050. This lays a little bit of groundwork for having "resign" mean "I don't want to review this, even if projects or packages I'm a member of need to", not just "remove me personally as a user reviewer".

Test Plan: Accepted, rejected and resigned from revisions without any major state issues.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T11114, T11050

Differential Revision: https://secure.phabricator.com/D17113
2016-12-31 10:09:27 -08:00

44 lines
1.3 KiB
PHP

<?php
final class DifferentialReviewerStatus extends Phobject {
const STATUS_BLOCKING = 'blocking';
const STATUS_ADDED = 'added';
const STATUS_ACCEPTED = 'accepted';
const STATUS_REJECTED = 'rejected';
const STATUS_COMMENTED = 'commented';
const STATUS_ACCEPTED_OLDER = 'accepted-older';
const STATUS_REJECTED_OLDER = 'rejected-older';
const STATUS_RESIGNED = 'resigned';
/**
* Returns the relative strength of a status, used to pick a winner when a
* transaction group makes several status changes to a particular reviewer.
*
* For example, if you accept a revision and leave a comment, the transactions
* will attempt to update you to both "commented" and "accepted". We want
* "accepted" to win, because it's the stronger of the two.
*
* @param const Reviewer status constant.
* @return int Relative strength (higher is stronger).
*/
public static function getStatusStrength($constant) {
$map = array(
self::STATUS_ADDED => 1,
self::STATUS_COMMENTED => 2,
self::STATUS_BLOCKING => 3,
self::STATUS_ACCEPTED_OLDER => 4,
self::STATUS_REJECTED_OLDER => 4,
self::STATUS_ACCEPTED => 5,
self::STATUS_REJECTED => 5,
self::STATUS_RESIGNED => 5,
);
return idx($map, $constant, 0);
}
}