2017-03-13 19:31:57 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
final class DifferentialReviewer
|
|
|
|
extends DifferentialDAO {
|
|
|
|
|
|
|
|
protected $revisionPHID;
|
|
|
|
protected $reviewerPHID;
|
|
|
|
protected $reviewerStatus;
|
2017-03-20 17:54:48 +01:00
|
|
|
protected $lastActionDiffPHID;
|
|
|
|
protected $lastCommentDiffPHID;
|
|
|
|
|
2017-03-20 20:35:30 +01:00
|
|
|
private $authority = array();
|
|
|
|
|
2017-03-13 19:31:57 +01:00
|
|
|
protected function getConfiguration() {
|
|
|
|
return array(
|
|
|
|
self::CONFIG_COLUMN_SCHEMA => array(
|
|
|
|
'reviewerStatus' => 'text64',
|
2017-03-20 17:54:48 +01:00
|
|
|
'lastActionDiffPHID' => 'phid?',
|
|
|
|
'lastCommentDiffPHID' => 'phid?',
|
2017-03-13 19:31:57 +01:00
|
|
|
),
|
|
|
|
self::CONFIG_KEY_SCHEMA => array(
|
|
|
|
'key_revision' => array(
|
|
|
|
'columns' => array('revisionPHID', 'reviewerPHID'),
|
|
|
|
'unique' => true,
|
|
|
|
),
|
2017-03-22 14:50:51 +01:00
|
|
|
'key_reviewer' => array(
|
|
|
|
'columns' => array('reviewerPHID', 'revisionPHID'),
|
|
|
|
),
|
2017-03-13 19:31:57 +01:00
|
|
|
),
|
|
|
|
) + parent::getConfiguration();
|
|
|
|
}
|
|
|
|
|
2017-03-20 20:35:30 +01:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
Store "resigned" as an explicit reviewer state
Summary:
Fixes T11050. Today, when a user resigns, we just delete the record of them ever being a reviewer.
However, this means you have no way to say "I don't care about this and don't want to see it on my dashboard" if you are a member of any project or package reviewers.
Instead, store "resigned" as a distinct state from "not a reviewer", and treat it a little differently in the UI:
- On the bucketing screen, discard revisions any responsible user has resigned from.
- On the main `/Dxxx` page, show these users as resigned explicitly (we could just hide them, too, but I think this is good to start with).
- In the query, don't treat a "resigned" state as a real "reviewer" (this change happened earlier, in D17517).
- When resigning, write a "resigned" state instead of deleting the row.
- When editing a list of reviewers, I'm still treating this reviewer as a reviewer and not special casing it. I think that's sufficiently clear but we could tailor this behavior later.
Test Plan:
- Resigned from a revision.
- Saw "Resigned" in reviewers list.
- Saw revision disappear from my dashboard.
- Edited revision, saw user still appear as an editable reviewer. Saved revision, saw no weird side effects.
Reviewers: chad
Reviewed By: chad
Maniphest Tasks: T11050
Differential Revision: https://secure.phabricator.com/D17531
2017-03-22 14:38:35 +01:00
|
|
|
public function isResigned() {
|
|
|
|
$status_resigned = DifferentialReviewerStatus::STATUS_RESIGNED;
|
|
|
|
return ($this->getReviewerStatus() == $status_resigned);
|
|
|
|
}
|
|
|
|
|
2017-03-13 19:31:57 +01:00
|
|
|
}
|