Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F97580591
DifferentialMailEngineExtension.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
Sun, Jan 5, 10:47
Size
2 KB
Mime Type
text/x-php
Expires
Tue, Jan 7, 10:47 (2 d)
Engine
blob
Format
Raw Data
Handle
23430572
Attached To
rPH Phabricator
DifferentialMailEngineExtension.php
View Options
<?php
final
class
DifferentialMailEngineExtension
extends
PhabricatorMailEngineExtension
{
const
EXTENSIONKEY
=
'differential'
;
public
function
supportsObject
(
$object
)
{
return
(
$object
instanceof
DifferentialRevision
);
}
public
function
newMailStampTemplates
(
$object
)
{
return
array
(
id
(
new
PhabricatorPHIDMailStamp
())
->
setKey
(
'author'
)
->
setLabel
(
pht
(
'Author'
)),
id
(
new
PhabricatorPHIDMailStamp
())
->
setKey
(
'reviewer'
)
->
setLabel
(
pht
(
'Reviewer'
)),
id
(
new
PhabricatorPHIDMailStamp
())
->
setKey
(
'blocking-reviewer'
)
->
setLabel
(
pht
(
'Reviewer'
)),
id
(
new
PhabricatorPHIDMailStamp
())
->
setKey
(
'resigned-reviewer'
)
->
setLabel
(
pht
(
'Reviewer'
)),
id
(
new
PhabricatorPHIDMailStamp
())
->
setKey
(
'revision-repository'
)
->
setLabel
(
pht
(
'Revision Repository'
)),
id
(
new
PhabricatorPHIDMailStamp
())
->
setKey
(
'revision-status'
)
->
setLabel
(
pht
(
'Revision Status'
)),
);
}
public
function
newMailStamps
(
$object
,
array
$xactions
)
{
$editor
=
$this
->
getEditor
();
$viewer
=
$this
->
getViewer
();
$revision
=
id
(
new
DifferentialRevisionQuery
())
->
setViewer
(
$viewer
)
->
needReviewers
(
true
)
->
withPHIDs
(
array
(
$object
->
getPHID
()))
->
executeOne
();
$reviewers
=
array
();
$blocking
=
array
();
$resigned
=
array
();
foreach
(
$revision
->
getReviewers
()
as
$reviewer
)
{
$reviewer_phid
=
$reviewer
->
getReviewerPHID
();
if
(
$reviewer
->
isResigned
())
{
$resigned
[]
=
$reviewer_phid
;
}
else
{
$reviewers
[]
=
$reviewer_phid
;
if
(
$reviewer
->
isBlocking
())
{
$blocking
[]
=
$reviewer_phid
;
}
}
}
$this
->
getMailStamp
(
'author'
)
->
setValue
(
$revision
->
getAuthorPHID
());
$this
->
getMailStamp
(
'reviewer'
)
->
setValue
(
$reviewers
);
$this
->
getMailStamp
(
'blocking-reviewer'
)
->
setValue
(
$blocking
);
$this
->
getMailStamp
(
'resigned-reviewer'
)
->
setValue
(
$resigned
);
$this
->
getMailStamp
(
'revision-repository'
)
->
setValue
(
$revision
->
getRepositoryPHID
());
$this
->
getMailStamp
(
'revision-status'
)
->
setValue
(
$revision
->
getModernRevisionStatus
());
}
}
Event Timeline
Log In to Comment