public function processRequest() { if (!PhabricatorEnv::getEnvConfig('feed.public')) { return new Aphront404Response(); } // TODO: Profile images won't render correctly for logged-out users. $request = $this->getRequest(); $query = new PhabricatorFeedQuery(); $stories = $query->execute(); $handles = array(); $objects = array(); if ($stories) { $handle_phids = array_mergev(mpull($stories, 'getRequiredHandlePHIDs')); $object_phids = array_mergev(mpull($stories, 'getRequiredObjectPHIDs')); $handles = id(new PhabricatorObjectHandleData($handle_phids))->loadHandles(); $objects = id(new PhabricatorObjectHandleData($object_phids))->loadObjects(); } // TODO: We need this for timezones but should develop some more general // solution for logged-out pages. $dummy_user = new PhabricatorUser(); $views = array(); foreach ($stories as $story) { $story->setHandles($handles); $story->setObjects($objects); $view = $story->renderView(); $view->setViewer($dummy_user); $views[] = $view->render(); } return $this->buildStandardPageResponse($views, array('title' => 'Public Feed', 'public' => true)); }
public function processRequest() { require_celerity_resource('phabricator-profile-css'); $viewer = $this->getRequest()->getUser(); $user = id(new PhabricatorPeopleQuery())->setViewer($viewer)->withUsernames(array($this->username))->needProfileImage(true)->executeOne(); if (!$user) { return new Aphront404Response(); } $query = new PhabricatorFeedQuery(); $query->setFilterPHIDs(array($user->getPHID())); $query->setLimit(100); $query->setViewer($viewer); $stories = $query->execute(); $builder = new PhabricatorFeedBuilder($stories); $builder->setUser($viewer); $builder->setShowHovercards(true); $builder->setNoDataString(pht('To begin on such a grand journey, requires but just a single step.')); $view = $builder->buildView(); $feed = phutil_tag_div('phabricator-project-feed', $view->render()); $name = $user->getUsername(); $nav = $this->buildIconNavView($user); $nav->selectFilter("{$name}/feed/"); $nav->appendChild($feed); return $this->buildApplicationPage($nav, array('title' => pht('Feed'))); }
private function renderFeedPage(PhabricatorProject $project) { $query = new PhabricatorFeedQuery(); $query->setFilterPHIDs(array($project->getPHID())); $query->setViewer($this->getRequest()->getUser()); $query->setLimit(100); $stories = $query->execute(); if (!$stories) { return pht('There are no stories about this project.'); } return $this->renderStories($stories); }
private function renderUserFeed(PhabricatorUser $user) { $viewer = $this->getRequest()->getUser(); $query = new PhabricatorFeedQuery(); $query->setFilterPHIDs(array($user->getPHID())); $query->setLimit(100); $query->setViewer($viewer); $stories = $query->execute(); $builder = new PhabricatorFeedBuilder($stories); $builder->setUser($viewer); $builder->setShowHovercards(true); $view = $builder->buildView(); return phutil_tag_div('profile-feed', $view->render()); }
public function processRequest() { if (!PhabricatorEnv::getEnvConfig('feed.public')) { return new Aphront404Response(); } // TODO: Profile images won't render correctly for logged-out users. $request = $this->getRequest(); $query = new PhabricatorFeedQuery(); $stories = $query->execute(); $builder = new PhabricatorFeedBuilder($stories); $builder->setFramed(true)->setUser($request->getUser()); $view = $builder->buildView(); return $this->buildStandardPageResponse($view, array('title' => 'Public Feed', 'public' => true)); }
private function buildPeopleFeed(PhabricatorUser $user, $viewer) { $query = new PhabricatorFeedQuery(); $query->setFilterPHIDs(array($user->getPHID())); $query->setLimit(100); $query->setViewer($viewer); $stories = $query->execute(); $builder = new PhabricatorFeedBuilder($stories); $builder->setUser($viewer); $builder->setShowHovercards(true); $builder->setNoDataString(pht('To begin on such a grand journey, ' . 'requires but just a single step.')); $view = $builder->buildView(); return $view->render(); }
public function processRequest() { if (!PhabricatorEnv::getEnvConfig('feed.public')) { return new Aphront404Response(); } $request = $this->getRequest(); $viewer = $request->getUser(); $query = new PhabricatorFeedQuery(); $query->setViewer($viewer); $query->setLimit(100); $stories = $query->execute(); $builder = new PhabricatorFeedBuilder($stories); $builder->setFramed(true)->setUser($viewer); $view = $builder->buildView(); return $this->buildStandardPageResponse($view, array('title' => 'Public Feed', 'public' => true)); }
public function processRequest() { if (!PhabricatorEnv::getEnvConfig('feed.public')) { return new Aphront404Response(); } $request = $this->getRequest(); $viewer = PhabricatorUser::getOmnipotentUser(); $query = new PhabricatorFeedQuery(); $query->setViewer($viewer); $query->setLimit(100); $stories = $query->execute(); $builder = new PhabricatorFeedBuilder($stories); $builder->setFramed(true)->setUser($viewer); $view = phutil_tag_div('phabricator-public-feed-frame', $builder->buildView()); return $this->buildStandardPageResponse($view, array('title' => pht('Public Feed'), 'public' => true)); }
public function processRequest() { $request = $this->getRequest(); $viewer = $request->getUser(); if ($request->isFormPost()) { $story = id(new PhabricatorFeedStoryPublisher())->setRelatedPHIDs(array($viewer->getPHID()))->setStoryType(PhabricatorFeedStoryTypeConstants::STORY_STATUS)->setStoryTime(time())->setStoryAuthorPHID($viewer->getPHID())->setStoryData(array('content' => $request->getStr('status')))->publish(); return id(new AphrontRedirectResponse())->setURI($request->getRequestURI()); } $query = new PhabricatorFeedQuery(); $stories = $query->execute(); $builder = new PhabricatorFeedBuilder($stories); $builder->setUser($request->getUser()); $view = $builder->buildView(); $post_form = id(new AphrontFormView())->setUser($viewer)->appendChild(id(new AphrontFormTextAreaControl())->setLabel('Pithy Wit')->setName('status'))->appendChild(id(new AphrontFormSubmitControl())->setValue('Publish')); $post = new AphrontPanelView(); $post->setWidth(AphrontPanelView::WIDTH_FORM); $post->setHeader('High Horse Soapbox'); $post->appendChild($post_form); $page = array(); $page[] = $post; $page[] = $view; return $this->buildStandardPageResponse($page, array('title' => 'Feed')); }
public function processRequest() { $request = $this->getRequest(); $viewer = $request->getUser(); if ($request->isFormPost()) { $story = id(new PhabricatorFeedStoryPublisher())->setRelatedPHIDs(array($viewer->getPHID()))->setStoryType(PhabricatorFeedStoryTypeConstants::STORY_STATUS)->setStoryTime(time())->setStoryAuthorPHID($viewer->getPHID())->setStoryData(array('content' => $request->getStr('status')))->publish(); return id(new AphrontRedirectResponse())->setURI($request->getRequestURI()); } $query = new PhabricatorFeedQuery(); $stories = $query->execute(); $handles = array(); $objects = array(); if ($stories) { $handle_phids = array_mergev(mpull($stories, 'getRequiredHandlePHIDs')); $object_phids = array_mergev(mpull($stories, 'getRequiredObjectPHIDs')); $handles = id(new PhabricatorObjectHandleData($handle_phids))->loadHandles(); $objects = id(new PhabricatorObjectHandleData($object_phids))->loadObjects(); } $views = array(); foreach ($stories as $story) { $story->setHandles($handles); $story->setObjects($objects); $view = $story->renderView(); $view->setViewer($viewer); $views[] = $view->render(); } $post_form = id(new AphrontFormView())->setUser($viewer)->appendChild(id(new AphrontFormTextAreaControl())->setLabel('Pithy Wit')->setName('status'))->appendChild(id(new AphrontFormSubmitControl())->setValue('Publish')); $post = new AphrontPanelView(); $post->setWidth(AphrontPanelView::WIDTH_FORM); $post->setHeader('High Horse Soapbox'); $post->appendChild($post_form); $page = array(); $page[] = $post; $page[] = $views; return $this->buildStandardPageResponse($page, array('title' => 'Feed')); }
private function buildFeedView(array $phids) { $request = $this->getRequest(); $user = $request->getUser(); $user_phid = $user->getPHID(); $feed_query = new PhabricatorFeedQuery(); $feed_query->setViewer($user); if ($phids) { $feed_query->setFilterPHIDs($phids); } $pager = new AphrontCursorPagerView(); $pager->readFromRequest($request); $pager->setPageSize(200); $feed = $feed_query->executeWithCursorPager($pager); $builder = new PhabricatorFeedBuilder($feed); $builder->setUser($user); $feed_view = $builder->buildView(); return '<div style="padding: 1em 3em;">' . '<div style="margin: 0 1em;">' . '<h1 style="font-size: 18px; ' . 'border-bottom: 1px solid #aaaaaa; ' . 'padding: 0;">Feed</h1>' . '</div>' . $feed_view->render() . '<div class="phabricator-feed-frame">' . $pager->render() . '</div>' . '</div>'; }
private function buildFeedView(array $phids) { $request = $this->getRequest(); $user = $request->getUser(); $user_phid = $user->getPHID(); $feed_query = new PhabricatorFeedQuery(); if ($phids) { $feed_query->setFilterPHIDs($phids); } // TODO: All this limit stuff should probably be consolidated into the // feed query? $old_link = null; $new_link = null; $feed_query->setAfter($request->getStr('after')); $feed_query->setBefore($request->getStr('before')); $limit = 500; // Grab one more story than we intend to display so we can figure out // if we need to render an "Older Posts" link or not (with reasonable // accuracy, at least). $feed_query->setLimit($limit + 1); $feed = $feed_query->execute(); $extra_row = count($feed) == $limit + 1; $have_new = $request->getStr('before') || $request->getStr('after') && $extra_row; $have_old = $request->getStr('after') || $request->getStr('before') && $extra_row || !$request->getStr('before') && !$request->getStr('after') && $extra_row; $feed = array_slice($feed, 0, $limit, $preserve_keys = true); if ($have_old) { $old_link = phutil_render_tag('a', array('href' => '?before=' . end($feed)->getChronologicalKey(), 'class' => 'phabricator-feed-older-link'), "Older Stories »"); } if ($have_new) { $new_link = phutil_render_tag('a', array('href' => '?after=' . reset($feed)->getChronologicalKey(), 'class' => 'phabricator-feed-newer-link'), "« Newer Stories"); } $builder = new PhabricatorFeedBuilder($feed); $builder->setUser($user); $feed_view = $builder->buildView(); return '<div style="padding: 1em 3em;">' . '<div style="margin: 0 1em;">' . '<h1 style="font-size: 18px; ' . 'border-bottom: 1px solid #aaaaaa; ' . 'padding: 0;">Feed</h1>' . '</div>' . $feed_view->render() . '<div class="phabricator-feed-frame">' . $new_link . $old_link . '</div>' . '</div>'; }
private function renderFeedPage(PhabricatorProject $project, PhabricatorProjectProfile $profile) { $query = new PhabricatorFeedQuery(); $query->setFilterPHIDs(array($project->getPHID())); $stories = $query->execute(); if (!$stories) { return 'There are no stories about this project.'; } $query = new PhabricatorFeedQuery(); $query->setFilterPHIDs(array($project->getPHID())); $stories = $query->execute(); return $this->renderStories($stories); }
private function renderUserFeed(PhabricatorUser $user) { $viewer = $this->getRequest()->getUser(); $query = new PhabricatorFeedQuery(); $query->setFilterPHIDs(array($user->getPHID())); $query->setLimit(100); $query->setViewer($viewer); $stories = $query->execute(); $builder = new PhabricatorFeedBuilder($stories); $builder->setUser($viewer); $view = $builder->buildView(); return '<div class="phabricator-profile-info-group"> <h1 class="phabricator-profile-info-header">Activity Feed</h1> <div class="phabricator-profile-info-pane"> ' . $view->render() . ' </div> </div>'; }