1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-11 17:32:41 +01:00
phorge-phorge/src/applications/notification/controller/PhabricatorNotificationPanelController.php

54 lines
1.3 KiB
PHP
Raw Normal View History

<?php
final class PhabricatorNotificationPanelController
extends PhabricatorNotificationController {
public function processRequest() {
$request = $this->getRequest();
$user = $request->getUser();
$query = new PhabricatorNotificationQuery();
$query->setViewer($user);
$query->setUserPHID($user->getPHID());
$query->setLimit(15);
$stories = $query->execute();
if ($stories) {
$builder = new PhabricatorNotificationBuilder($stories);
$notifications_view = $builder->buildView();
$content = $notifications_view->render();
} else {
$content =
'<div class="phabricator-notification no-notifications">'.
'You have no notifications.'.
'</div>';
}
$content =
'<div class="phabricator-notification-header">'.
pht('Notifications').
'</div>'.
$content.
'<div class="phabricator-notification-view-all">'.
phutil_tag(
'a',
array(
'href' => '/notification/',
),
'View All Notifications').
'</div>';
$unread_count = id(new PhabricatorFeedStoryNotification())
->countUnread($user);
$json = array(
'content' => $content,
'number' => $unread_count,
);
return id(new AphrontAjaxResponse())->setContent($json);
}
}