Changeset View
Changeset View
Standalone View
Standalone View
src/applications/differential/storage/DifferentialReviewer.php
| <?php | <?php | ||||
| final class DifferentialReviewer | final class DifferentialReviewer | ||||
| extends DifferentialDAO { | extends DifferentialDAO { | ||||
| protected $revisionPHID; | protected $revisionPHID; | ||||
| protected $reviewerPHID; | protected $reviewerPHID; | ||||
| protected $reviewerStatus; | protected $reviewerStatus; | ||||
| protected $lastActionDiffPHID; | protected $lastActionDiffPHID; | ||||
| protected $lastCommentDiffPHID; | protected $lastCommentDiffPHID; | ||||
| private $authority = array(); | |||||
| protected function getConfiguration() { | protected function getConfiguration() { | ||||
| return array( | return array( | ||||
| self::CONFIG_COLUMN_SCHEMA => array( | self::CONFIG_COLUMN_SCHEMA => array( | ||||
| 'reviewerStatus' => 'text64', | 'reviewerStatus' => 'text64', | ||||
| 'lastActionDiffPHID' => 'phid?', | 'lastActionDiffPHID' => 'phid?', | ||||
| 'lastCommentDiffPHID' => 'phid?', | 'lastCommentDiffPHID' => 'phid?', | ||||
| ), | ), | ||||
| self::CONFIG_KEY_SCHEMA => array( | self::CONFIG_KEY_SCHEMA => array( | ||||
| 'key_revision' => array( | 'key_revision' => array( | ||||
| 'columns' => array('revisionPHID', 'reviewerPHID'), | 'columns' => array('revisionPHID', 'reviewerPHID'), | ||||
| 'unique' => true, | 'unique' => true, | ||||
| ), | ), | ||||
| ), | ), | ||||
| ) + parent::getConfiguration(); | ) + parent::getConfiguration(); | ||||
| } | } | ||||
| public function getStatus() { | |||||
| // TODO: This is an older method for compatibility with some callers | |||||
| // which have not yet been cleaned up. | |||||
| return $this->getReviewerStatus(); | |||||
| } | |||||
| public function isUser() { | |||||
| $user_type = PhabricatorPeopleUserPHIDType::TYPECONST; | |||||
| return (phid_get_type($this->getReviewerPHID()) == $user_type); | |||||
| } | |||||
| public function attachAuthority(PhabricatorUser $user, $has_authority) { | |||||
| $this->authority[$user->getCacheFragment()] = $has_authority; | |||||
| return $this; | |||||
| } | |||||
| public function hasAuthority(PhabricatorUser $viewer) { | |||||
| $cache_fragment = $viewer->getCacheFragment(); | |||||
| return $this->assertAttachedKey($this->authority, $cache_fragment); | |||||
| } | |||||
| } | } | ||||