forked from phacility/phabricator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPhabricatorSettingsIssueController.php
103 lines (87 loc) · 2.63 KB
/
PhabricatorSettingsIssueController.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<?php
final class PhabricatorSettingsIssueController
extends PhabricatorController {
public function handleRequest(AphrontRequest $request) {
$viewer = $request->getViewer();
$setup_uri = id(new PhabricatorEmailAddressesSettingsPanel())
->setViewer($viewer)
->setUser($viewer)
->getPanelURI();
$issues = array();
if (!$viewer->getIsEmailVerified()) {
// We could specifically detect that the user has missed email because
// their address is unverified here and point them at Mail so they can
// look at messages they missed.
// We could also detect that an administrator unverified their address
// and let that come with a message.
// For now, just make sure the unverified address does not escape notice.
$issues[] = array(
'title' => pht('Primary Email Unverified'),
'summary' => pht(
'Your primary email address is unverified. You will not be able '.
'to receive email until you verify it.'),
'uri' => $setup_uri,
);
}
if ($issues) {
require_celerity_resource('phabricator-notification-menu-css');
$items = array();
foreach ($issues as $issue) {
$classes = array();
$classes[] = 'phabricator-notification';
$classes[] = 'phabricator-notification-unread';
$uri = $issue['uri'];
$title = $issue['title'];
$summary = $issue['summary'];
$items[] = javelin_tag(
'div',
array(
'class' =>
'phabricator-notification phabricator-notification-unread',
'sigil' => 'notification',
'meta' => array(
'href' => $uri,
),
),
array(
phutil_tag('strong', array(), pht('%s:', $title)),
' ',
$summary,
));
}
$content = phutil_tag(
'div',
array(
'class' => 'setup-issue-menu',
),
$items);
} else {
$content = phutil_tag(
'div',
array(
'class' => 'phabricator-notification no-notifications',
),
pht('You have no account setup issues.'));
}
$header = phutil_tag(
'div',
array(
'class' => 'phabricator-notification-header',
),
phutil_tag(
'a',
array(
'href' => $setup_uri,
),
pht('Account Setup Issues')));
$content = array(
$header,
$content,
);
$json = array(
'content' => hsprintf('%s', $content),
'number' => count($issues),
);
return id(new AphrontAjaxResponse())->setContent($json);
}
}