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

Remove unused PhabricatorFeedStory subclasses

Summary: Remove a bunch of unused `PhabricatorFeedStory` subclasses.

Test Plan: `grep`

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: btrahan, Korvin, epriestley

Maniphest Tasks: T5655

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

-734
-14
src/__phutil_library_map__.php
··· 1832 1832 'PhabricatorFeedQuery' => 'applications/feed/query/PhabricatorFeedQuery.php', 1833 1833 'PhabricatorFeedSearchEngine' => 'applications/feed/query/PhabricatorFeedSearchEngine.php', 1834 1834 'PhabricatorFeedStory' => 'applications/feed/story/PhabricatorFeedStory.php', 1835 - 'PhabricatorFeedStoryAggregate' => 'applications/feed/story/PhabricatorFeedStoryAggregate.php', 1836 - 'PhabricatorFeedStoryAudit' => 'applications/feed/story/PhabricatorFeedStoryAudit.php', 1837 - 'PhabricatorFeedStoryCommit' => 'applications/feed/story/PhabricatorFeedStoryCommit.php', 1838 1835 'PhabricatorFeedStoryData' => 'applications/feed/storage/PhabricatorFeedStoryData.php', 1839 - 'PhabricatorFeedStoryDifferential' => 'applications/feed/story/PhabricatorFeedStoryDifferential.php', 1840 - 'PhabricatorFeedStoryDifferentialAggregate' => 'applications/feed/story/PhabricatorFeedStoryDifferentialAggregate.php', 1841 - 'PhabricatorFeedStoryManiphestAggregate' => 'applications/feed/story/PhabricatorFeedStoryManiphestAggregate.php', 1842 1836 'PhabricatorFeedStoryNotification' => 'applications/notification/storage/PhabricatorFeedStoryNotification.php', 1843 - 'PhabricatorFeedStoryPhriction' => 'applications/feed/story/PhabricatorFeedStoryPhriction.php', 1844 1837 'PhabricatorFeedStoryPublisher' => 'applications/feed/PhabricatorFeedStoryPublisher.php', 1845 1838 'PhabricatorFeedStoryReference' => 'applications/feed/storage/PhabricatorFeedStoryReference.php', 1846 1839 'PhabricatorFile' => 'applications/files/storage/PhabricatorFile.php', ··· 5225 5218 'PhabricatorPolicyInterface', 5226 5219 'PhabricatorMarkupInterface', 5227 5220 ), 5228 - 'PhabricatorFeedStoryAggregate' => 'PhabricatorFeedStory', 5229 - 'PhabricatorFeedStoryAudit' => 'PhabricatorFeedStory', 5230 - 'PhabricatorFeedStoryCommit' => 'PhabricatorFeedStory', 5231 5221 'PhabricatorFeedStoryData' => 'PhabricatorFeedDAO', 5232 - 'PhabricatorFeedStoryDifferential' => 'PhabricatorFeedStory', 5233 - 'PhabricatorFeedStoryDifferentialAggregate' => 'PhabricatorFeedStoryAggregate', 5234 - 'PhabricatorFeedStoryManiphestAggregate' => 'PhabricatorFeedStoryAggregate', 5235 5222 'PhabricatorFeedStoryNotification' => 'PhabricatorFeedDAO', 5236 - 'PhabricatorFeedStoryPhriction' => 'PhabricatorFeedStory', 5237 5223 'PhabricatorFeedStoryReference' => 'PhabricatorFeedDAO', 5238 5224 'PhabricatorFile' => array( 5239 5225 'PhabricatorFileDAO',
-74
src/applications/feed/story/PhabricatorFeedStoryAggregate.php
··· 1 - <?php 2 - 3 - abstract class PhabricatorFeedStoryAggregate extends PhabricatorFeedStory { 4 - 5 - private $aggregateStories = array(); 6 - 7 - public function getHasViewed() { 8 - return head($this->getAggregateStories())->getHasViewed(); 9 - } 10 - 11 - public function getPrimaryObjectPHID() { 12 - return head($this->getAggregateStories())->getPrimaryObjectPHID(); 13 - } 14 - 15 - public function getRequiredHandlePHIDs() { 16 - $phids = array(); 17 - foreach ($this->getAggregateStories() as $story) { 18 - $phids[] = $story->getRequiredHandlePHIDs(); 19 - } 20 - return array_mergev($phids); 21 - } 22 - 23 - public function getRequiredObjectPHIDs() { 24 - $phids = array(); 25 - foreach ($this->getAggregateStories() as $story) { 26 - $phids[] = $story->getRequiredObjectPHIDs(); 27 - } 28 - return array_mergev($phids); 29 - } 30 - 31 - protected function getAuthorPHIDs() { 32 - $authors = array(); 33 - foreach ($this->getAggregateStories() as $story) { 34 - $authors[] = $story->getStoryData()->getAuthorPHID(); 35 - } 36 - return array_unique(array_filter($authors)); 37 - } 38 - 39 - protected function getDataValues($key, $default) { 40 - $result = array(); 41 - foreach ($this->getAggregateStories() as $key => $story) { 42 - $result[$key] = $story->getStoryData()->getValue($key, $default); 43 - } 44 - return $result; 45 - } 46 - 47 - final public function setAggregateStories(array $aggregate_stories) { 48 - assert_instances_of($aggregate_stories, 'PhabricatorFeedStory'); 49 - $this->aggregateStories = $aggregate_stories; 50 - 51 - $objects = array(); 52 - $handles = array(); 53 - 54 - foreach ($this->aggregateStories as $story) { 55 - $objects += $story->getObjects(); 56 - $handles += $story->getHandles(); 57 - } 58 - 59 - $this->setObjects($objects); 60 - $this->setHandles($handles); 61 - 62 - return $this; 63 - } 64 - 65 - final public function getAggregateStories() { 66 - return $this->aggregateStories; 67 - } 68 - 69 - final public function getNotificationAggregations() { 70 - throw new Exception( 71 - 'You can not get aggregations for an aggregate story.'); 72 - } 73 - 74 - }
-49
src/applications/feed/story/PhabricatorFeedStoryAudit.php
··· 1 - <?php 2 - 3 - final class PhabricatorFeedStoryAudit extends PhabricatorFeedStory { 4 - 5 - public function getPrimaryObjectPHID() { 6 - return $this->getStoryData()->getValue('commitPHID'); 7 - } 8 - 9 - public function renderView() { 10 - $author_phid = $this->getAuthorPHID(); 11 - $commit_phid = $this->getPrimaryObjectPHID(); 12 - 13 - $view = $this->newStoryView(); 14 - 15 - $action = $this->getValue('action'); 16 - $verb = PhabricatorAuditActionConstants::getActionPastTenseVerb($action); 17 - 18 - $view->setTitle(hsprintf( 19 - '%s %s commit %s.', 20 - $this->linkTo($author_phid), 21 - $verb, 22 - $this->linkTo($commit_phid))); 23 - 24 - $comments = $this->getValue('content'); 25 - $view->setImage($this->getHandle($author_phid)->getImageURI()); 26 - 27 - if ($comments) { 28 - $content = $this->renderSummary($this->getValue('content')); 29 - $view->appendChild($content); 30 - } 31 - 32 - return $view; 33 - } 34 - 35 - public function renderText() { 36 - $author_name = $this->getHandle($this->getAuthorPHID())->getLinkName(); 37 - 38 - $commit_path = $this->getHandle($this->getPrimaryObjectPHID())->getURI(); 39 - $commit_uri = PhabricatorEnv::getURI($commit_path); 40 - 41 - $action = $this->getValue('action'); 42 - $verb = PhabricatorAuditActionConstants::getActionPastTenseVerb($action); 43 - 44 - $text = "{$author_name} {$verb} commit {$commit_uri}"; 45 - 46 - return $text; 47 - } 48 - 49 - }
-107
src/applications/feed/story/PhabricatorFeedStoryCommit.php
··· 1 - <?php 2 - 3 - final class PhabricatorFeedStoryCommit extends PhabricatorFeedStory { 4 - 5 - public function getPrimaryObjectPHID() { 6 - return $this->getValue('commitPHID'); 7 - } 8 - 9 - public function getRequiredHandlePHIDs() { 10 - return array( 11 - $this->getValue('committerPHID'), 12 - ); 13 - } 14 - 15 - public function renderView() { 16 - $data = $this->getStoryData(); 17 - 18 - $author = null; 19 - if ($data->getValue('authorPHID')) { 20 - $author = $this->linkTo($data->getValue('authorPHID')); 21 - } else { 22 - $author = $data->getValue('authorName'); 23 - } 24 - 25 - $committer = null; 26 - if ($data->getValue('committerPHID')) { 27 - $committer = $this->linkTo($data->getValue('committerPHID')); 28 - } else if ($data->getValue('committerName')) { 29 - $committer = $data->getValue('committerName'); 30 - } 31 - 32 - $commit = $this->linkTo($data->getValue('commitPHID')); 33 - 34 - if (!$committer) { 35 - $committer = $author; 36 - $author = null; 37 - } 38 - 39 - if ($author) { 40 - $title = pht( 41 - '%s committed %s (authored by %s)', 42 - $committer, 43 - $commit, 44 - $author); 45 - } else { 46 - $title = pht( 47 - '%s committed %s', 48 - $committer, 49 - $commit); 50 - } 51 - 52 - $view = $this->newStoryView(); 53 - 54 - $view->setTitle($title); 55 - 56 - if ($data->getValue('authorPHID')) { 57 - $view->setImage($this->getHandle($data->getAuthorPHID())->getImageURI()); 58 - } 59 - 60 - $content = $this->renderSummary($data->getValue('summary')); 61 - $view->appendChild($content); 62 - 63 - return $view; 64 - } 65 - 66 - public function renderText() { 67 - $author = null; 68 - if ($this->getAuthorPHID()) { 69 - $author = $this->getHandle($this->getAuthorPHID())->getLinkName(); 70 - } else { 71 - $author = $this->getValue('authorName'); 72 - } 73 - 74 - $committer = null; 75 - if ($this->getValue('committerPHID')) { 76 - $committer_handle = $this->getHandle($this->getValue('committerPHID')); 77 - $committer = $committer_handle->getLinkName(); 78 - } else if ($this->getValue('committerName')) { 79 - $committer = $this->getValue('committerName'); 80 - } 81 - 82 - $commit_handle = $this->getHandle($this->getPrimaryObjectPHID()); 83 - $commit_uri = PhabricatorEnv::getURI($commit_handle->getURI()); 84 - $commit_name = $commit_handle->getLinkName(); 85 - 86 - if (!$committer) { 87 - $committer = $author; 88 - $author = null; 89 - } 90 - 91 - if ($author) { 92 - $text = pht( 93 - '%s committed %s (authored by %s).', 94 - $committer, 95 - $commit_name, 96 - $author); 97 - } else { 98 - $text = pht( 99 - '%s committed %s.', 100 - $committer, 101 - $commit_name); 102 - } 103 - 104 - return $text; 105 - } 106 - 107 - }
-237
src/applications/feed/story/PhabricatorFeedStoryDifferential.php
··· 1 - <?php 2 - 3 - final class PhabricatorFeedStoryDifferential extends PhabricatorFeedStory { 4 - 5 - public function getPrimaryObjectPHID() { 6 - return $this->getValue('revision_phid'); 7 - } 8 - 9 - public function renderView() { 10 - $data = $this->getStoryData(); 11 - 12 - $view = $this->newStoryView(); 13 - 14 - $line = $this->getLineForData($data); 15 - $view->setTitle($line); 16 - 17 - $href = $this->getHandle($data->getValue('revision_phid'))->getURI(); 18 - $view->setHref($href); 19 - 20 - $action = $data->getValue('action'); 21 - 22 - switch ($action) { 23 - case DifferentialAction::ACTION_CREATE: 24 - case DifferentialAction::ACTION_CLOSE: 25 - case DifferentialAction::ACTION_COMMENT: 26 - $full_size = true; 27 - break; 28 - default: 29 - $full_size = false; 30 - break; 31 - } 32 - 33 - $view->setImage($this->getHandle($data->getAuthorPHID())->getImageURI()); 34 - if ($full_size) { 35 - $content = $this->renderSummary($data->getValue('feedback_content')); 36 - $view->appendChild($content); 37 - } 38 - 39 - return $view; 40 - } 41 - 42 - private function getLineForData($data) { 43 - $actor_phid = $data->getAuthorPHID(); 44 - $revision_phid = $data->getValue('revision_phid'); 45 - $action = $data->getValue('action'); 46 - 47 - $actor_link = $this->linkTo($actor_phid); 48 - $revision_link = $this->linkTo($revision_phid); 49 - 50 - switch ($action) { 51 - case DifferentialAction::ACTION_COMMENT: 52 - $one_line = pht('%s commented on revision %s', 53 - $actor_link, $revision_link); 54 - break; 55 - case DifferentialAction::ACTION_ACCEPT: 56 - $one_line = pht('%s accepted revision %s', 57 - $actor_link, $revision_link); 58 - break; 59 - case DifferentialAction::ACTION_REJECT: 60 - $one_line = pht('%s requested changes to revision %s', 61 - $actor_link, $revision_link); 62 - break; 63 - case DifferentialAction::ACTION_RETHINK: 64 - $one_line = pht('%s planned changes to revision %s', 65 - $actor_link, $revision_link); 66 - break; 67 - case DifferentialAction::ACTION_ABANDON: 68 - $one_line = pht('%s abandoned revision %s', 69 - $actor_link, $revision_link); 70 - break; 71 - case DifferentialAction::ACTION_CLOSE: 72 - $one_line = pht('%s closed revision %s', 73 - $actor_link, $revision_link); 74 - break; 75 - case DifferentialAction::ACTION_REQUEST: 76 - $one_line = pht('%s requested a review of revision %s', 77 - $actor_link, $revision_link); 78 - break; 79 - case DifferentialAction::ACTION_RECLAIM: 80 - $one_line = pht('%s reclaimed revision %s', 81 - $actor_link, $revision_link); 82 - break; 83 - case DifferentialAction::ACTION_UPDATE: 84 - $one_line = pht('%s updated revision %s', 85 - $actor_link, $revision_link); 86 - break; 87 - case DifferentialAction::ACTION_RESIGN: 88 - $one_line = pht('%s resigned from revision %s', 89 - $actor_link, $revision_link); 90 - break; 91 - case DifferentialAction::ACTION_SUMMARIZE: 92 - $one_line = pht('%s summarized revision %s', 93 - $actor_link, $revision_link); 94 - break; 95 - case DifferentialAction::ACTION_TESTPLAN: 96 - $one_line = pht('%s explained the test plan for revision %s', 97 - $actor_link, $revision_link); 98 - break; 99 - case DifferentialAction::ACTION_CREATE: 100 - $one_line = pht('%s created revision %s', 101 - $actor_link, $revision_link); 102 - break; 103 - case DifferentialAction::ACTION_ADDREVIEWERS: 104 - $one_line = pht('%s added reviewers to revision %s', 105 - $actor_link, $revision_link); 106 - break; 107 - case DifferentialAction::ACTION_ADDCCS: 108 - $one_line = pht('%s added CCs to revision %s', 109 - $actor_link, $revision_link); 110 - break; 111 - case DifferentialAction::ACTION_CLAIM: 112 - $one_line = pht('%s commandeered revision %s', 113 - $actor_link, $revision_link); 114 - break; 115 - case DifferentialAction::ACTION_REOPEN: 116 - $one_line = pht('%s reopened revision %s', 117 - $actor_link, $revision_link); 118 - break; 119 - case DifferentialTransaction::TYPE_INLINE: 120 - $one_line = pht('%s added inline comments to %s', 121 - $actor_link, $revision_link); 122 - break; 123 - default: 124 - $one_line = pht('%s edited %s', 125 - $actor_link, $revision_link); 126 - break; 127 - } 128 - 129 - return $one_line; 130 - } 131 - 132 - public function renderText() { 133 - $author_name = $this->getHandle($this->getAuthorPHID())->getLinkName(); 134 - 135 - $revision_handle = $this->getHandle($this->getPrimaryObjectPHID()); 136 - $revision_title = $revision_handle->getLinkName(); 137 - $revision_uri = PhabricatorEnv::getURI($revision_handle->getURI()); 138 - 139 - $action = $this->getValue('action'); 140 - 141 - switch ($action) { 142 - case DifferentialAction::ACTION_COMMENT: 143 - $one_line = pht('%s commented on revision %s %s', 144 - $author_name, $revision_title, $revision_uri); 145 - break; 146 - case DifferentialAction::ACTION_ACCEPT: 147 - $one_line = pht('%s accepted revision %s %s', 148 - $author_name, $revision_title, $revision_uri); 149 - break; 150 - case DifferentialAction::ACTION_REJECT: 151 - $one_line = pht('%s requested changes to revision %s %s', 152 - $author_name, $revision_title, $revision_uri); 153 - break; 154 - case DifferentialAction::ACTION_RETHINK: 155 - $one_line = pht('%s planned changes to revision %s %s', 156 - $author_name, $revision_title, $revision_uri); 157 - break; 158 - case DifferentialAction::ACTION_ABANDON: 159 - $one_line = pht('%s abandoned revision %s %s', 160 - $author_name, $revision_title, $revision_uri); 161 - break; 162 - case DifferentialAction::ACTION_CLOSE: 163 - $one_line = pht('%s closed revision %s %s', 164 - $author_name, $revision_title, $revision_uri); 165 - break; 166 - case DifferentialAction::ACTION_REQUEST: 167 - $one_line = pht('%s requested a review of revision %s %s', 168 - $author_name, $revision_title, $revision_uri); 169 - break; 170 - case DifferentialAction::ACTION_RECLAIM: 171 - $one_line = pht('%s reclaimed revision %s %s', 172 - $author_name, $revision_title, $revision_uri); 173 - break; 174 - case DifferentialAction::ACTION_UPDATE: 175 - $one_line = pht('%s updated revision %s %s', 176 - $author_name, $revision_title, $revision_uri); 177 - break; 178 - case DifferentialAction::ACTION_RESIGN: 179 - $one_line = pht('%s resigned from revision %s %s', 180 - $author_name, $revision_title, $revision_uri); 181 - break; 182 - case DifferentialAction::ACTION_SUMMARIZE: 183 - $one_line = pht('%s summarized revision %s %s', 184 - $author_name, $revision_title, $revision_uri); 185 - break; 186 - case DifferentialAction::ACTION_TESTPLAN: 187 - $one_line = pht('%s explained the test plan for revision %s %s', 188 - $author_name, $revision_title, $revision_uri); 189 - break; 190 - case DifferentialAction::ACTION_CREATE: 191 - $one_line = pht('%s created revision %s %s', 192 - $author_name, $revision_title, $revision_uri); 193 - break; 194 - case DifferentialAction::ACTION_ADDREVIEWERS: 195 - $one_line = pht('%s added reviewers to revision %s %s', 196 - $author_name, $revision_title, $revision_uri); 197 - break; 198 - case DifferentialAction::ACTION_ADDCCS: 199 - $one_line = pht('%s added CCs to revision %s %s', 200 - $author_name, $revision_title, $revision_uri); 201 - break; 202 - case DifferentialAction::ACTION_CLAIM: 203 - $one_line = pht('%s commandeered revision %s %s', 204 - $author_name, $revision_title, $revision_uri); 205 - break; 206 - case DifferentialAction::ACTION_REOPEN: 207 - $one_line = pht('%s reopened revision %s %s', 208 - $author_name, $revision_title, $revision_uri); 209 - break; 210 - case DifferentialTransaction::TYPE_INLINE: 211 - $one_line = pht('%s added inline comments to %s %s', 212 - $author_name, $revision_title, $revision_uri); 213 - break; 214 - default: 215 - $one_line = pht('%s edited %s %s', 216 - $author_name, $revision_title, $revision_uri); 217 - break; 218 - } 219 - 220 - return $one_line; 221 - } 222 - 223 - public function getNotificationAggregations() { 224 - $class = get_class($this); 225 - $phid = $this->getStoryData()->getValue('revision_phid'); 226 - $read = (int)$this->getHasViewed(); 227 - 228 - // Don't aggregate updates separated by more than 2 hours. 229 - $block = (int)($this->getEpoch() / (60 * 60 * 2)); 230 - 231 - return array( 232 - "{$class}:{$phid}:{$read}:{$block}" 233 - => 'PhabricatorFeedStoryDifferentialAggregate', 234 - ); 235 - } 236 - 237 - }
-66
src/applications/feed/story/PhabricatorFeedStoryDifferentialAggregate.php
··· 1 - <?php 2 - 3 - final class PhabricatorFeedStoryDifferentialAggregate 4 - extends PhabricatorFeedStoryAggregate { 5 - 6 - public function renderView() { 7 - $data = $this->getStoryData(); 8 - 9 - $task_link = $this->linkTo($data->getValue('revision_phid')); 10 - 11 - $authors = $this->getAuthorPHIDs(); 12 - 13 - // TODO: These aren't really translatable because linkTo() returns a 14 - // string, not an object with a gender. 15 - 16 - switch (count($authors)) { 17 - case 1: 18 - $author = $this->linkTo(array_shift($authors)); 19 - $title = pht( 20 - '%s made multiple updates to %s', 21 - $author, 22 - $task_link); 23 - break; 24 - case 2: 25 - $author1 = $this->linkTo(array_shift($authors)); 26 - $author2 = $this->linkTo(array_shift($authors)); 27 - $title = pht( 28 - '%s and %s made multiple updates to %s', 29 - $author1, 30 - $author2, 31 - $task_link); 32 - break; 33 - case 3: 34 - $author1 = $this->linkTo(array_shift($authors)); 35 - $author2 = $this->linkTo(array_shift($authors)); 36 - $author3 = $this->linkTo(array_shift($authors)); 37 - $title = pht( 38 - '%s, %s, and %s made multiple updates to %s', 39 - $author1, 40 - $author2, 41 - $author3, 42 - $task_link); 43 - break; 44 - default: 45 - $author1 = $this->linkTo(array_shift($authors)); 46 - $author2 = $this->linkTo(array_shift($authors)); 47 - $others = count($authors); 48 - $title = pht( 49 - '%s, %s, and %d others made multiple updates to %s', 50 - $author1, 51 - $author2, 52 - $others, 53 - $task_link); 54 - break; 55 - } 56 - 57 - $view = $this->newStoryView(); 58 - $view->setTitle($title); 59 - 60 - $href = $this->getHandle($data->getValue('revision_phid'))->getURI(); 61 - $view->setHref($href); 62 - 63 - return $view; 64 - } 65 - 66 - }
-66
src/applications/feed/story/PhabricatorFeedStoryManiphestAggregate.php
··· 1 - <?php 2 - 3 - final class PhabricatorFeedStoryManiphestAggregate 4 - extends PhabricatorFeedStoryAggregate { 5 - 6 - public function renderView() { 7 - $data = $this->getStoryData(); 8 - 9 - $task_link = $this->linkTo($data->getValue('taskPHID')); 10 - 11 - $authors = $this->getAuthorPHIDs(); 12 - 13 - // TODO: These aren't really translatable because linkTo() returns a 14 - // string, not an object with a gender. 15 - 16 - switch (count($authors)) { 17 - case 1: 18 - $author = $this->linkTo(array_shift($authors)); 19 - $title = pht( 20 - '%s made multiple updates to %s', 21 - $author, 22 - $task_link); 23 - break; 24 - case 2: 25 - $author1 = $this->linkTo(array_shift($authors)); 26 - $author2 = $this->linkTo(array_shift($authors)); 27 - $title = pht( 28 - '%s and %s made multiple updates to %s', 29 - $author1, 30 - $author2, 31 - $task_link); 32 - break; 33 - case 3: 34 - $author1 = $this->linkTo(array_shift($authors)); 35 - $author2 = $this->linkTo(array_shift($authors)); 36 - $author3 = $this->linkTo(array_shift($authors)); 37 - $title = pht( 38 - '%s, %s, and %s made multiple updates to %s', 39 - $author1, 40 - $author2, 41 - $author3, 42 - $task_link); 43 - break; 44 - default: 45 - $author1 = $this->linkTo(array_shift($authors)); 46 - $author2 = $this->linkTo(array_shift($authors)); 47 - $others = count($authors); 48 - $title = pht( 49 - '%s, %s, and %d others made multiple updates to %s', 50 - $author1, 51 - $author2, 52 - $others, 53 - $task_link); 54 - break; 55 - } 56 - 57 - $view = $this->newStoryView(); 58 - $view->setTitle($title); 59 - 60 - $href = $this->getHandle($data->getValue('taskPHID'))->getURI(); 61 - $view->setHref($href); 62 - 63 - return $view; 64 - } 65 - 66 - }
-95
src/applications/feed/story/PhabricatorFeedStoryPhriction.php
··· 1 - <?php 2 - 3 - final class PhabricatorFeedStoryPhriction extends PhabricatorFeedStory { 4 - 5 - public function getPrimaryObjectPHID() { 6 - return $this->getValue('phid'); 7 - } 8 - 9 - public function getRequiredHandlePHIDs() { 10 - $required_phids = parent::getRequiredHandlePHIDs(); 11 - $from_phid = $this->getStoryData()->getValue('movedFromPHID'); 12 - if ($from_phid) { 13 - $required_phids[] = $from_phid; 14 - } 15 - return $required_phids; 16 - } 17 - 18 - public function renderView() { 19 - $data = $this->getStoryData(); 20 - 21 - $author_phid = $data->getAuthorPHID(); 22 - $author_link = $this->linkTo($author_phid); 23 - $document_phid = $data->getValue('phid'); 24 - 25 - $view = $this->newStoryView(); 26 - 27 - $action = $data->getValue('action'); 28 - $verb = PhrictionActionConstants::getActionPastTenseVerb($action); 29 - 30 - switch ($action) { 31 - case PhrictionActionConstants::ACTION_MOVE_HERE: 32 - $from_phid = $data->getValue('movedFromPHID'); 33 - 34 - // Older feed stories may not have 'moved_from_phid', in that case 35 - // we fall back to the default behaviour (hence the fallthrough) 36 - if ($from_phid) { 37 - $document_handle = $this->getHandle($document_phid); 38 - $from_handle = $this->getHandle($from_phid); 39 - $view->setTitle(pht( 40 - '%s moved the document %s from %s to %s.', 41 - $author_link, 42 - $document_handle->renderLink(), 43 - phutil_tag( 44 - 'a', 45 - array( 46 - 'href' => $from_handle->getURI(), 47 - ), 48 - $from_handle->getURI()), 49 - phutil_tag( 50 - 'a', 51 - array( 52 - 'href' => $document_handle->getURI(), 53 - ), 54 - $document_handle->getURI()))); 55 - break; 56 - } 57 - /* Fallthrough */ 58 - default: 59 - $view->setTitle(pht( 60 - '%s %s the document %s.', 61 - $author_link, 62 - $verb, 63 - $this->linkTo($document_phid))); 64 - break; 65 - } 66 - 67 - $view->setImage($this->getHandle($author_phid)->getImageURI()); 68 - switch ($action) { 69 - case PhrictionActionConstants::ACTION_CREATE: 70 - $content = $this->renderSummary($data->getValue('content')); 71 - $view->appendChild($content); 72 - break; 73 - } 74 - 75 - return $view; 76 - } 77 - 78 - public function renderText() { 79 - $author_handle = $this->getHandle($this->getAuthorPHID()); 80 - $author_name = $author_handle->getName(); 81 - 82 - $document_handle = $this->getHandle($this->getPrimaryObjectPHID()); 83 - $document_title = $document_handle->getLinkName(); 84 - $document_uri = PhabricatorEnv::getURI($document_handle->getURI()); 85 - 86 - $action = $this->getValue('action'); 87 - $verb = PhrictionActionConstants::getActionPastTenseVerb($action); 88 - 89 - $text = "{$author_name} {$verb} the document". 90 - " {$document_title} {$document_uri}"; 91 - 92 - return $text; 93 - } 94 - 95 - }
-26
src/applications/notification/builder/PhabricatorNotificationBuilder.php
··· 26 26 // nowhere sensible for the notification to link to, and no reasonable way 27 27 // to unambiguously clear it. 28 28 29 - // Each notification emits keys it can aggregate on. For instance, if this 30 - // story is "a updated T123", it might emit a key like this: 31 - // 32 - // task:phid123:unread => PhabricatorFeedStoryManiphestAggregate 33 - // 34 - // All the unread notifications about the task with PHID "phid123" will 35 - // emit the same key, telling us we can aggregate them into a single 36 - // story of type "PhabricatorFeedStoryManiphestAggregate", which could 37 - // read like "a and b updated T123". 38 - // 39 - // A story might be able to aggregate in multiple ways. Although this is 40 - // unlikely for stories in a notification context, stories in a feed context 41 - // can also aggregate by actor: 42 - // 43 - // task:phid123 => PhabricatorFeedStoryManiphestAggregate 44 - // actor:user123 => PhabricatorFeedStoryActorAggregate 45 - // 46 - // This means the story can either become "a and b updated T123" or 47 - // "a updated T123 and T456". When faced with multiple possibilities, it's 48 - // our job to choose the best aggregation. 49 - // 50 - // For now, we use a simple greedy algorithm and repeatedly select the 51 - // aggregate story which consumes the largest number of individual stories 52 - // until no aggregate story exists that consumes more than one story. 53 - 54 - 55 29 // Build up a map of all the possible aggregations. 56 30 57 31 $chronokey_map = array();