3 final class PhabricatorNotificationIndividualController
4 extends PhabricatorNotificationController
{
6 public function handleRequest(AphrontRequest
$request) {
7 $viewer = $request->getViewer();
9 $stories = id(new PhabricatorNotificationQuery())
11 ->withUserPHIDs(array($viewer->getPHID()))
12 ->withKeys(array($request->getStr('key')))
16 return $this->buildEmptyResponse();
19 $story = head($stories);
20 if ($story->getAuthorPHID() === $viewer->getPHID()) {
21 // Don't show the user individual notifications about their own
22 // actions. Primarily, this stops pages from showing notifications
23 // immediately after you click "Submit" on a comment form if the
24 // notification server returns faster than the web server.
26 // TODO: It would be nice to retain the "page updated" bubble on copies
27 // of the page that are open in other tabs, but there isn't an obvious
28 // way to do this easily.
30 return $this->buildEmptyResponse();
33 $builder = id(new PhabricatorNotificationBuilder(array($story)))
35 ->setShowTimestamps(false);
37 $content = $builder->buildView()->render();
38 $dict = $builder->buildDict();
41 $response = $data +
array(
43 'primaryObjectPHID' => $story->getPrimaryObjectPHID(),
44 'content' => hsprintf('%s', $content),
45 'uniqueID' => 'story/'.$story->getChronologicalKey(),
48 return id(new AphrontAjaxResponse())->setContent($response);
51 private function buildEmptyResponse() {
52 return id(new AphrontAjaxResponse())->setContent(