2018-02-05 10:31:56 -08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
final class PhabricatorPHIDMailStamp
|
|
|
|
extends PhabricatorMailStamp {
|
|
|
|
|
|
|
|
const STAMPTYPE = 'phid';
|
|
|
|
|
|
|
|
public function renderStamps($value) {
|
|
|
|
if ($value === null) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
$value = (array)$value;
|
|
|
|
if (!$value) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2018-02-13 17:53:36 -08:00
|
|
|
// TODO: This recovers from a bug where blocking reviewers were serialized
|
|
|
|
// incorrectly into the flat mail stamp list in the worker queue as arrays.
|
|
|
|
// It can be removed some time after February 2018.
|
|
|
|
foreach ($value as $key => $v) {
|
|
|
|
if (is_array($v)) {
|
|
|
|
unset($value[$key]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-02-05 10:31:56 -08:00
|
|
|
$viewer = $this->getViewer();
|
|
|
|
$handles = $viewer->loadHandles($value);
|
|
|
|
|
|
|
|
$results = array();
|
|
|
|
foreach ($value as $phid) {
|
|
|
|
$handle = $handles[$phid];
|
|
|
|
|
|
|
|
$mail_name = $handle->getMailStampName();
|
|
|
|
if ($mail_name === null) {
|
|
|
|
$mail_name = $handle->getPHID();
|
|
|
|
}
|
|
|
|
|
|
|
|
$results[] = $this->renderStamp($this->getKey(), $mail_name);
|
|
|
|
}
|
|
|
|
|
|
|
|
return $results;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|