Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/applications/metamta/stamp/PhabricatorPHIDMailStamp.php
12256 views
1
<?php
2
3
final class PhabricatorPHIDMailStamp
4
extends PhabricatorMailStamp {
5
6
const STAMPTYPE = 'phid';
7
8
public function renderStamps($value) {
9
if ($value === null) {
10
return null;
11
}
12
13
$value = (array)$value;
14
if (!$value) {
15
return null;
16
}
17
18
// TODO: This recovers from a bug where blocking reviewers were serialized
19
// incorrectly into the flat mail stamp list in the worker queue as arrays.
20
// It can be removed some time after February 2018.
21
foreach ($value as $key => $v) {
22
if (is_array($v)) {
23
unset($value[$key]);
24
}
25
}
26
27
$viewer = $this->getViewer();
28
$handles = $viewer->loadHandles($value);
29
30
$results = array();
31
foreach ($value as $phid) {
32
$handle = $handles[$phid];
33
34
$mail_name = $handle->getMailStampName();
35
if ($mail_name === null) {
36
$mail_name = $handle->getPHID();
37
}
38
39
$results[] = $this->renderStamp($this->getKey(), $mail_name);
40
}
41
42
return $results;
43
}
44
45
}
46
47