Page Menu
Home
GnuPG
Search
Configure Global Search
Log In
Files
F29856758
PhabricatorMetaMTAMemberQuery.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Size
1 KB
Subscribers
None
PhabricatorMetaMTAMemberQuery.php
View Options
<?php
/**
* Expands aggregate mail recipients into their component mailables. For
* example, a project currently expands into all of its members.
*/
final
class
PhabricatorMetaMTAMemberQuery
extends
PhabricatorQuery
{
private
$phids
=
array
();
private
$viewer
;
public
function
setViewer
(
PhabricatorUser
$viewer
)
{
$this
->
viewer
=
$viewer
;
return
$this
;
}
public
function
getViewer
()
{
return
$this
->
viewer
;
}
public
function
withPHIDs
(
array
$phids
)
{
$this
->
phids
=
$phids
;
return
$this
;
}
public
function
execute
()
{
$phids
=
array_fuse
(
$this
->
phids
);
$actors
=
array
();
$type_map
=
array
();
foreach
(
$phids
as
$phid
)
{
$type_map
[
phid_get_type
(
$phid
)][]
=
$phid
;
}
// TODO: Generalize this somewhere else.
$results
=
array
();
foreach
(
$type_map
as
$type
=>
$phids
)
{
switch
(
$type
)
{
case
PhabricatorProjectPHIDTypeProject
::
TYPECONST
:
// TODO: For now, project members are always on the "mailing list"
// implied by the project, but we should differentiate members and
// subscribers (i.e., allow you to unsubscribe from mail about
// a project).
$projects
=
id
(
new
PhabricatorProjectQuery
())
->
setViewer
(
$this
->
getViewer
())
->
needMembers
(
true
)
->
withPHIDs
(
$phids
)
->
execute
();
$projects
=
mpull
(
$projects
,
null
,
'getPHID'
);
foreach
(
$phids
as
$phid
)
{
$project
=
idx
(
$projects
,
$phid
);
if
(!
$project
)
{
$results
[
$phid
]
=
array
();
}
else
{
$results
[
$phid
]
=
$project
->
getMemberPHIDs
();
}
}
break
;
default
:
break
;
}
}
return
$results
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Thu, Oct 16, 4:47 AM (20 h, 43 m)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
62/e9/eadcb138b17215a0ae2ff6a3bb2c
Attached To
rPHAB Phabricator
Event Timeline
Log In to Comment