protected function execute(ConduitAPIRequest $request)
 {
     $type = $request->getValue('type');
     $data = $request->getValue('data');
     $time = $request->getValue('time');
     $author_phid = $request->getUser()->getPHID();
     $phids = array($author_phid);
     $publisher = new PhabricatorFeedStoryPublisher();
     $publisher->setStoryType($type);
     $publisher->setStoryData($data);
     $publisher->setStoryTime($time);
     $publisher->setRelatedPHIDs($phids);
     $publisher->setStoryAuthorPHID($author_phid);
     $data = $publisher->publish();
     return $data->getPHID();
 }
 private function publishFeedStory(PhabricatorRepository $repository, PhabricatorRepositoryCommit $commit, PhabricatorRepositoryCommitData $data)
 {
     if (time() > $commit->getEpoch() + 24 * 60 * 60) {
         // Don't publish stories that are more than 24 hours old, to avoid
         // ridiculous levels of feed spam if a repository is imported without
         // disabling feed publishing.
         return;
     }
     $author_phid = $commit->getAuthorPHID();
     $committer_phid = $data->getCommitDetail('committerPHID');
     $publisher = new PhabricatorFeedStoryPublisher();
     $publisher->setStoryType(PhabricatorFeedStoryTypeConstants::STORY_COMMIT);
     $publisher->setStoryData(array('commitPHID' => $commit->getPHID(), 'summary' => $data->getSummary(), 'authorName' => $data->getAuthorName(), 'authorPHID' => $author_phid, 'committerName' => $data->getCommitDetail('committer'), 'committerPHID' => $committer_phid));
     $publisher->setStoryTime($commit->getEpoch());
     $publisher->setRelatedPHIDs(array_filter(array($author_phid, $committer_phid)));
     if ($author_phid) {
         $publisher->setStoryAuthorPHID($author_phid);
     }
     $publisher->publish();
 }