getRequest(); $user = $request->getUser(); $query = new PhabricatorNotificationQuery(); $query->setUserPHID($user->getPHID()); $query->setLimit(15); $stories = $query->execute(); $num_unconsumed = 0; if ($stories) { $builder = new PhabricatorNotificationBuilder($stories); $notifications_view = $builder->buildView(); foreach ($stories as $story) { if (!$story->getHasViewed()) { $num_unconsumed++; } } $content = $notifications_view->render(); } else { $content = '
'. 'You have no notifications.'. '
'; } $content .= '
'. phutil_render_tag( 'a', array( 'href' => '/notification/', ), 'View All Notifications'). '
'; $json = array( 'content' => $content, 'number' => $num_unconsumed, ); return id(new AphrontAjaxResponse())->setContent($json); } }