@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Improve robustnesss of feed text rendering

Summary:
Couple of minor cleanup things here:

- Pass handles to ApplicationTransactions when rendering their stories; this happened implicitly before but doesn't now.
- Add `?text=1` to do ad-hoc rendering of a story in text mode.
- Make Conduit skip unrenderable stories.
- Fix/modernize some text in the Commit story.

Test Plan: Rendered text versions of stories via Conduit and `?text=1`.

Reviewers: btrahan, chad

Reviewed By: chad

Subscribers: zeeg, spicyj, epriestley

Differential Revision: https://secure.phabricator.com/D8793

+24 -6
+1 -1
src/aphront/response/AphrontPlainTextResponse.php
··· 16 16 17 17 public function getHeaders() { 18 18 $headers = array( 19 - array('Content-Type', 'text/plain'), 19 + array('Content-Type', 'text/plain; charset=utf-8'), 20 20 ); 21 21 22 22 return array_merge(parent::getHeaders(), $headers);
+8 -1
src/applications/feed/conduit/ConduitAPI_feed_query_Method.php
··· 95 95 96 96 $data = null; 97 97 98 - $view = $story->renderView(); 98 + try { 99 + $view = $story->renderView(); 100 + } catch (Exception $ex) { 101 + // When stories fail to render, just fail that story. 102 + phlog($ex); 103 + continue; 104 + } 105 + 99 106 $view->setEpoch($story->getEpoch()); 100 107 $view->setUser($user); 101 108
+5 -1
src/applications/feed/controller/PhabricatorFeedDetailController.php
··· 20 20 return new Aphront404Response(); 21 21 } 22 22 23 + if ($request->getStr('text')) { 24 + $text = $story->renderText(); 25 + return id(new AphrontPlainTextResponse())->setContent($text); 26 + } 27 + 23 28 $feed = array($story); 24 29 $builder = new PhabricatorFeedBuilder($feed); 25 30 $builder->setUser($user); ··· 31 36 32 37 $crumbs = $this->buildApplicationCrumbs(); 33 38 $crumbs->addTextCrumb($title); 34 - 35 39 36 40 return $this->buildApplicationPage( 37 41 array(
+9 -3
src/applications/feed/story/PhabricatorFeedStoryCommit.php
··· 90 90 } 91 91 92 92 if ($author) { 93 - $text = "{$committer} (authored by {$author})". 94 - "committed {$commit_name} {$commit_uri}"; 93 + $text = pht( 94 + '%s committed %s (authored by %s).', 95 + $committer, 96 + $commit_name, 97 + $author); 95 98 } else { 96 - $text = "{$committer} committed {$commit_name} {$commit_uri}"; 99 + $text = pht( 100 + '%s committed %s.', 101 + $committer, 102 + $commit_name); 97 103 } 98 104 99 105 return $text;
+1
src/applications/transactions/feed/PhabricatorApplicationTransactionFeedStory.php
··· 69 69 $old_target = $xaction->getRenderingTarget(); 70 70 $new_target = PhabricatorApplicationTransaction::TARGET_TEXT; 71 71 $xaction->setRenderingTarget($new_target); 72 + $xaction->setHandles($this->getHandles()); 72 73 $text = $xaction->getTitleForFeed($this); 73 74 $xaction->setRenderingTarget($old_target); 74 75 return $text;