[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/applications/notification/controller/ -> PhabricatorNotificationTestController.php (source)

   1  <?php
   2  
   3  final class PhabricatorNotificationTestController
   4    extends PhabricatorNotificationController {
   5  
   6    public function processRequest() {
   7      $request = $this->getRequest();
   8      $viewer = $request->getUser();
   9  
  10      $story_type = 'PhabricatorNotificationAdHocFeedStory';
  11      $story_data = array(
  12        'title' => pht(
  13          'This is a test notification, sent at %s.',
  14          phabricator_datetime(time(), $viewer)),
  15      );
  16  
  17      $viewer_phid = $viewer->getPHID();
  18  
  19      // TODO: When it's easier to get these buttons to render as forms, this
  20      // would be slightly nicer as a more standard isFormPost() check.
  21  
  22      if ($request->validateCSRF()) {
  23        id(new PhabricatorFeedStoryPublisher())
  24          ->setStoryType($story_type)
  25          ->setStoryData($story_data)
  26          ->setStoryTime(time())
  27          ->setStoryAuthorPHID($viewer_phid)
  28          ->setRelatedPHIDs(array($viewer_phid))
  29          ->setPrimaryObjectPHID($viewer_phid)
  30          ->setSubscribedPHIDs(array($viewer_phid))
  31          ->setNotifyAuthor(true)
  32          ->publish();
  33      }
  34  
  35      return id(new AphrontAjaxResponse());
  36    }
  37  
  38  }


Generated: Sun Nov 30 09:20:46 2014 Cross-referenced by PHPXref 0.7.1