Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F93888266
PhabricatorNotificationPanelController.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
Mon, Dec 2, 07:08
Size
2 KB
Mime Type
text/x-php
Expires
Wed, Dec 4, 07:08 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
22719798
Attached To
rPH Phabricator
PhabricatorNotificationPanelController.php
View Options
<?php
final
class
PhabricatorNotificationPanelController
extends
PhabricatorNotificationController
{
public
function
processRequest
()
{
$request
=
$this
->
getRequest
();
$user
=
$request
->
getUser
();
$query
=
id
(
new
PhabricatorNotificationQuery
())
->
setViewer
(
$user
)
->
withUserPHIDs
(
array
(
$user
->
getPHID
()))
->
setLimit
(
15
);
$stories
=
$query
->
execute
();
$clear_ui_class
=
'phabricator-notification-clear-all'
;
$clear_uri
=
id
(
new
PhutilURI
(
'/notification/clear/'
));
if
(
$stories
)
{
$builder
=
new
PhabricatorNotificationBuilder
(
$stories
);
$notifications_view
=
$builder
->
buildView
();
$content
=
$notifications_view
->
render
();
$clear_uri
->
setQueryParam
(
'chronoKey'
,
head
(
$stories
)->
getChronologicalKey
());
}
else
{
$content
=
phutil_tag_div
(
'phabricator-notification no-notifications'
,
pht
(
'You have no notifications.'
));
$clear_ui_class
.=
' disabled'
;
}
$clear_ui
=
javelin_tag
(
'a'
,
array
(
'sigil'
=>
'workflow'
,
'href'
=>
(
string
)
$clear_uri
,
'class'
=>
$clear_ui_class
,
),
pht
(
'Mark All Read'
));
$notifications_link
=
phutil_tag
(
'a'
,
array
(
'href'
=>
'/notification/'
,
),
pht
(
'Notifications'
));
if
(
PhabricatorEnv
::
getEnvConfig
(
'notification.enabled'
))
{
$connection_status
=
new
PhabricatorNotificationStatusView
();
}
else
{
$connection_status
=
phutil_tag
(
'a'
,
array
(
'href'
=>
PhabricatorEnv
::
getDoclink
(
'Notifications User Guide: Setup and Configuration'
),
),
pht
(
'Notification Server not enabled.'
));
}
$connection_ui
=
phutil_tag
(
'div'
,
array
(
'class'
=>
'phabricator-notification-footer'
,
),
$connection_status
);
$header
=
phutil_tag
(
'div'
,
array
(
'class'
=>
'phabricator-notification-header'
,
),
array
(
$notifications_link
,
$clear_ui
,
));
$content
=
hsprintf
(
'%s%s%s'
,
$header
,
$content
,
$connection_ui
);
$unread_count
=
id
(
new
PhabricatorFeedStoryNotification
())
->
countUnread
(
$user
);
$json
=
array
(
'content'
=>
$content
,
'number'
=>
(
int
)
$unread_count
,
);
return
id
(
new
AphrontAjaxResponse
())->
setContent
(
$json
);
}
}
Event Timeline
Log In to Comment