@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.

Add Hovercards / restyle feed one line stories.

Summary: This adds hovercards to most stories and removes the profile photo from one line stories. I don't know about my implementation, which has difficulties with application transactions (because it shows status). Which leads me to a bigger question, which is can we render all people through a common function like AphrontTagView so we can easily class and/or hovercard it anywhere.

Test Plan: Reviewed my feed, various stories.

Reviewers: epriestley, btrahan

Reviewed By: epriestley

CC: aran, Korvin

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

+77 -36
+2 -2
src/__celerity_resource_map__.php
··· 3791 3791 ), 3792 3792 'phui-feed-story-css' => 3793 3793 array( 3794 - 'uri' => '/res/5d7ab26c/rsrc/css/phui/phui-feed-story.css', 3794 + 'uri' => '/res/68a0ce41/rsrc/css/phui/phui-feed-story.css', 3795 3795 'type' => 'css', 3796 3796 'requires' => 3797 3797 array( ··· 3827 3827 ), 3828 3828 'phui-remarkup-preview-css' => 3829 3829 array( 3830 - 'uri' => '/res/6c886e63/rsrc/css/phui/phui-remarkup-preview.css', 3830 + 'uri' => '/res/4535e062/rsrc/css/phui/phui-remarkup-preview.css', 3831 3831 'type' => 'css', 3832 3832 'requires' => 3833 3833 array(
+9 -1
src/applications/feed/story/PhabricatorFeedStory.php
··· 232 232 // NOTE: We render our own link here to customize the styling and add 233 233 // the '_top' target for framed feeds. 234 234 235 - return phutil_tag( 235 + $class = null; 236 + if ($handle->getType() == PhabricatorPeoplePHIDTypeUser::TYPECONST) { 237 + $class = 'phui-link-person'; 238 + } 239 + 240 + return javelin_tag( 236 241 'a', 237 242 array( 238 243 'href' => $handle->getURI(), 239 244 'target' => $this->framed ? '_top' : null, 245 + 'sigil' => 'hovercard', 246 + 'meta' => array('hoverPHID' => $phid), 247 + 'class' => $class, 240 248 ), 241 249 $handle->getLinkName()); 242 250 }
+6 -4
src/applications/feed/story/PhabricatorFeedStoryPhriction.php
··· 19 19 $data = $this->getStoryData(); 20 20 21 21 $author_phid = $data->getAuthorPHID(); 22 + $author_link = $this->linkTo($author_phid); 22 23 $document_phid = $data->getValue('phid'); 23 24 24 25 $view = $this->newStoryView(); ··· 38 39 $from_handle = $this->getHandle($from_phid); 39 40 $view->setTitle(pht( 40 41 '%s moved the document %s from %s to %s.', 41 - $this->linkTo($author_phid), 42 + $author_link, 42 43 $document_handle->renderLink(), 43 44 phutil_tag( 44 45 'a', ··· 58 59 default: 59 60 $view->setTitle(pht( 60 61 '%s %s the document %s.', 61 - $this->linkTo($author_phid), 62 + $author_link, 62 63 $verb, 63 64 $this->linkTo($document_phid))); 64 65 break; ··· 76 77 } 77 78 78 79 public function renderText() { 79 - $author_name = $this->getHandle($this->getAuthorPHID())->getLinkName(); 80 + $author_phid = $this->getHandle($this->getAuthorPHID()); 81 + $author_link = $this->linkTo($author_phid); 80 82 81 83 $document_handle = $this->getHandle($this->getPrimaryObjectPHID()); 82 84 $document_title = $document_handle->getLinkName(); ··· 85 87 $action = $this->getValue('action'); 86 88 $verb = PhrictionActionConstants::getActionPastTenseVerb($action); 87 89 88 - $text = "{$author_name} {$verb} the document". 90 + $text = "{$author_link} {$verb} the document". 89 91 " {$document_title} {$document_uri}"; 90 92 91 93 return $text;
+43 -23
src/applications/feed/story/PhabricatorFeedStoryProject.php
··· 33 33 $proj_phid = $data->getValue('projectPHID'); 34 34 35 35 $author_phid = $data->getAuthorPHID(); 36 + $author_link = $this->linkTo($author_phid); 36 37 37 38 switch ($type) { 38 39 case PhabricatorProjectTransactionType::TYPE_NAME: 39 40 if (strlen($old)) { 40 - $action = hsprintf( 41 - 'renamed project %s from %s to %s.', 41 + $action = pht( 42 + '% renamed project %s from %s to %s.', 43 + $author_link, 42 44 $this->linkTo($proj_phid), 43 45 $this->renderString($old), 44 46 $this->renderString($new)); 45 47 } else { 46 - $action = hsprintf( 47 - 'created project %s (as %s).', 48 + $action = pht( 49 + '% created project %s (as %s).', 50 + $author_link, 48 51 $this->linkTo($proj_phid), 49 52 $this->renderString($new)); 50 53 } ··· 52 55 case PhabricatorProjectTransactionType::TYPE_STATUS: 53 56 $old_name = PhabricatorProjectStatus::getNameForStatus($old); 54 57 $new_name = PhabricatorProjectStatus::getNameForStatus($new); 55 - $action = hsprintf( 56 - 'changed project %s status from %s to %s.', 58 + $action = pht( 59 + '%s changed project %s status from %s to %s.', 60 + $author_link, 57 61 $this->linkTo($proj_phid), 58 62 $this->renderString($old_name), 59 63 $this->renderString($new_name)); ··· 64 68 65 69 if ((count($add) == 1) && (count($rem) == 0) && 66 70 (head($add) == $author_phid)) { 67 - $action = hsprintf('joined project %s.', $this->linkTo($proj_phid)); 71 + $action = pht( 72 + '% joined project %s.', 73 + $author_link, 74 + $this->linkTo($proj_phid)); 68 75 } else if ((count($add) == 0) && (count($rem) == 1) && 69 76 (head($rem) == $author_phid)) { 70 - $action = hsprintf('left project %s.', $this->linkTo($proj_phid)); 77 + $action = pht( 78 + '%s left project %s.', 79 + $author_link, 80 + $this->linkTo($proj_phid)); 71 81 } else if (empty($rem)) { 72 - $action = hsprintf( 73 - 'added members to project %s: %s.', 82 + $action = pht( 83 + '%s added members to project %s: %s.', 84 + $author_link, 74 85 $this->linkTo($proj_phid), 75 86 $this->renderHandleList($add)); 76 87 } else if (empty($add)) { 77 - $action = hsprintf( 78 - 'removed members from project %s: %s.', 88 + $action = pht( 89 + '%s removed members from project %s: %s.', 90 + $author_link, 79 91 $this->linkTo($proj_phid), 80 92 $this->renderHandleList($rem)); 81 93 } else { 82 - $action = hsprintf( 83 - 'changed members of project %s, added: %s; removed: %s.', 94 + $action = pht( 95 + '%s changed members of project %s, added: %s; removed: %s.', 96 + $author_link, 84 97 $this->linkTo($proj_phid), 85 98 $this->renderHandleList($add), 86 99 $this->renderHandleList($rem)); 87 100 } 88 101 break; 89 102 case PhabricatorProjectTransactionType::TYPE_CAN_VIEW: 90 - $action = hsprintf( 91 - 'changed the visibility for %s.', 103 + $action = pht( 104 + '%s changed the visibility for %s.', 105 + $author_link, 92 106 $this->linkTo($proj_phid)); 93 107 break; 94 108 case PhabricatorProjectTransactionType::TYPE_CAN_EDIT: 95 - $action = hsprintf( 96 - 'changed the edit policy for %s.', 109 + $action = pht( 110 + '%s changed the edit policy for %s.', 111 + $author_link, 97 112 $this->linkTo($proj_phid)); 98 113 break; 99 114 case PhabricatorProjectTransactionType::TYPE_CAN_JOIN: 100 - $action = hsprintf( 101 - 'changed the join policy for %s.', 115 + $action = pht( 116 + '%s changed the join policy for %s.', 117 + $author_link, 102 118 $this->linkTo($proj_phid)); 103 119 break; 104 120 default: 105 - $action = hsprintf('updated project %s.', $this->linkTo($proj_phid)); 121 + $action = pht( 122 + '%s updated project %s.', 123 + $author_link, 124 + $this->linkTo($proj_phid)); 106 125 break; 107 126 } 108 - $view->setTitle(hsprintf('%s %s', $this->linkTo($author_phid), $action)); 127 + 128 + $view->setTitle($action); 109 129 $view->setImage($this->getHandle($author_phid)->getImageURI()); 110 130 111 131 return $view; ··· 121 141 $proj_uri = PhabricatorEnv::getURI($proj_handle->getURI()); 122 142 123 143 $author_phid = $this->getAuthorPHID(); 124 - $author_name = $this->getHandle($author_phid)->getLinkName(); 144 + $author_name = $this->linkTo($author_phid); 125 145 126 146 switch ($type) { 127 147 case PhabricatorProjectTransactionType::TYPE_NAME:
+1 -1
src/applications/feed/story/PhabricatorFeedStoryStatus.php
··· 28 28 $author_name = $author_handle->getLinkName(); 29 29 $author_uri = PhabricatorEnv::getURI($author_handle->getURI()); 30 30 31 - $text = pht('% supdated their status %s', $author_name, $author_uri); 31 + $text = pht('% updated their status %s', $author_name, $author_uri); 32 32 33 33 return $text; 34 34 }
+8 -4
src/applications/phid/PhabricatorObjectHandle.php
··· 172 172 if ($name === null) { 173 173 $name = $this->getLinkName(); 174 174 } 175 - $class = null; 175 + $classes = array(); 176 176 $title = $this->title; 177 177 178 178 if ($this->status != PhabricatorObjectHandleStatus::STATUS_OPEN) { 179 - $class .= ' handle-status-'.$this->status; 179 + $classes[] = 'handle-status-'.$this->status; 180 180 $title = $title ? $title : $this->status; 181 181 } 182 182 183 183 if ($this->disabled) { 184 - $class .= ' handle-disabled'; 184 + $classes[] = 'handle-disabled'; 185 185 $title = 'disabled'; // Overwrite status. 186 186 } 187 187 188 + if ($this->getType() == PhabricatorPeoplePHIDTypeUser::TYPECONST) { 189 + $classes[] = 'phui-link-person'; 190 + } 191 + 188 192 return phutil_tag( 189 193 'a', 190 194 array( 191 195 'href' => $this->getURI(), 192 - 'class' => $class, 196 + 'class' => implode(' ', $classes), 193 197 'title' => $title, 194 198 ), 195 199 $name);
+2 -1
src/view/phui/PHUIFeedStoryView.php
··· 123 123 public function render() { 124 124 125 125 require_celerity_resource('phui-feed-story-css'); 126 + Javelin::initBehavior('phabricator-hovercards'); 126 127 $oneline = $this->isEmptyContent($this->renderChildren()); 127 128 128 129 $body = null; ··· 204 205 'class' => 'phui-feed-story-head', 205 206 ), 206 207 array( 207 - $actor, 208 + (!$oneline ? $actor : null), 208 209 nonempty($this->title, pht('Untitled Story')), 209 210 $icons, 210 211 $ol_foot
+6
webroot/rsrc/css/phui/phui-feed-story.css
··· 19 19 .phui-feed-story-head { 20 20 padding: 8px; 21 21 overflow: hidden; 22 + color: #555; 23 + } 24 + 25 + .phui-feed-story-head .phui-link-person { 22 26 color: #333; 27 + font-weight: bold; 23 28 } 24 29 25 30 .phui-feed-story-body { ··· 99 104 color: #777; 100 105 margin-top: 2px; 101 106 line-height: 14px; 107 + font-weight: normal; 102 108 } 103 109