Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F103662181
DifferentialReviewer.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Mon, Mar 3, 19:52
Size
2 KB
Mime Type
text/x-php
Expires
Wed, Mar 5, 19:52 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
24632193
Attached To
rPH Phabricator
DifferentialReviewer.php
View Options
<?php
final
class
DifferentialReviewer
extends
DifferentialDAO
{
protected
$revisionPHID
;
protected
$reviewerPHID
;
protected
$reviewerStatus
;
protected
$lastActionDiffPHID
;
protected
$lastCommentDiffPHID
;
protected
$lastActorPHID
;
private
$authority
=
array
();
protected
function
getConfiguration
()
{
return
array
(
self
::
CONFIG_COLUMN_SCHEMA
=>
array
(
'reviewerStatus'
=>
'text64'
,
'lastActionDiffPHID'
=>
'phid?'
,
'lastCommentDiffPHID'
=>
'phid?'
,
'lastActorPHID'
=>
'phid?'
,
),
self
::
CONFIG_KEY_SCHEMA
=>
array
(
'key_revision'
=>
array
(
'columns'
=>
array
(
'revisionPHID'
,
'reviewerPHID'
),
'unique'
=>
true
,
),
'key_reviewer'
=>
array
(
'columns'
=>
array
(
'reviewerPHID'
,
'revisionPHID'
),
),
),
)
+
parent
::
getConfiguration
();
}
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
);
}
public
function
isResigned
()
{
$status_resigned
=
DifferentialReviewerStatus
::
STATUS_RESIGNED
;
return
(
$this
->
getReviewerStatus
()
==
$status_resigned
);
}
public
function
isAccepted
(
$diff_phid
)
{
$status_accepted
=
DifferentialReviewerStatus
::
STATUS_ACCEPTED
;
if
(
$this
->
getReviewerStatus
()
!=
$status_accepted
)
{
return
false
;
}
if
(!
$diff_phid
)
{
return
true
;
}
$action_phid
=
$this
->
getLastActionDiffPHID
();
if
(!
$action_phid
)
{
return
true
;
}
if
(
$action_phid
==
$diff_phid
)
{
return
true
;
}
$sticky_key
=
'differential.sticky-accept'
;
$is_sticky
=
PhabricatorEnv
::
getEnvConfig
(
$sticky_key
);
if
(
$is_sticky
)
{
return
true
;
}
return
false
;
}
}
Event Timeline
Log In to Comment