1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-09-23 02:38:48 +02:00
phorge-phorge/src/applications/notification/controller/PhabricatorNotificationPanelController.php
Chad Little b2debb14c7 Mobile Notifications
Summary: Touch up /notifications/ for desktop and mobile

Test Plan: Tested read and unread notifications on mobile and desktop

Reviewers: epriestley, btrahan

Reviewed By: epriestley

CC: Korvin, epriestley, aran

Differential Revision: https://secure.phabricator.com/D7671
2013-12-03 11:58:10 -08:00

51 lines
1.3 KiB
PHP

<?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 = phutil_tag_div(
'phabricator-notification no-notifications',
pht('You have no notifications.'));
}
$content = hsprintf(
'<div class="phabricator-notification-header">%s</div>'.
'%s'.
'<div class="phabricator-notification-view-all">%s</div>',
pht('Notifications'),
$content,
phutil_tag(
'a',
array(
'href' => '/notification/',
),
pht('View All Notifications')));
$unread_count = id(new PhabricatorFeedStoryNotification())
->countUnread($user);
$json = array(
'content' => $content,
'number' => (int)$unread_count,
);
return id(new AphrontAjaxResponse())->setContent($json);
}
}