@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 Projects to Ponder Search View

Summary: Ref T3578 Allows display of projects if available on individual ponder search results.

Test Plan: Added projects to my questions, see them display on search results.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

Maniphest Tasks: T3578

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

+66 -2
+27 -1
src/applications/ponder/query/PonderQuestionQuery.php
··· 8 8 private $authorPHIDs; 9 9 private $answererPHIDs; 10 10 11 + private $needProjectPHIDs; 12 + 11 13 private $status = 'status-any'; 12 14 13 15 const STATUS_ANY = 'status-any'; ··· 49 51 50 52 public function needViewerVotes($need_viewer_votes) { 51 53 $this->needViewerVotes = $need_viewer_votes; 54 + return $this; 55 + } 56 + 57 + public function needProjectPHIDs($need_projects) { 58 + $this->needProjectPHIDs = $need_projects; 52 59 return $this; 53 60 } 54 61 ··· 109 116 } 110 117 111 118 protected function willFilterPage(array $questions) { 119 + 120 + $phids = mpull($questions, 'getPHID'); 121 + 112 122 if ($this->needAnswers) { 113 123 $aquery = id(new PonderAnswerQuery()) 114 124 ->setViewer($this->getViewer()) ··· 133 143 134 144 $etype = PonderQuestionHasVotingUserEdgeType::EDGECONST; 135 145 $edges = id(new PhabricatorEdgeQuery()) 136 - ->withSourcePHIDs(mpull($questions, 'getPHID')) 146 + ->withSourcePHIDs($phids) 137 147 ->withDestinationPHIDs(array($viewer_phid)) 138 148 ->withEdgeTypes(array($etype)) 139 149 ->needEdgeData(true) ··· 145 155 array()); 146 156 147 157 $question->attachUserVote($viewer_phid, idx($user_edge, 'data', 0)); 158 + } 159 + } 160 + 161 + if ($this->needProjectPHIDs) { 162 + $edge_query = id(new PhabricatorEdgeQuery()) 163 + ->withSourcePHIDs($phids) 164 + ->withEdgeTypes( 165 + array( 166 + PhabricatorProjectObjectHasProjectEdgeType::EDGECONST, 167 + )); 168 + $edge_query->execute(); 169 + 170 + foreach ($questions as $question) { 171 + $project_phids = $edge_query->getDestinationPHIDs( 172 + array($question->getPHID())); 173 + $question->attachProjectPHIDs($project_phids); 148 174 } 149 175 } 150 176
+26 -1
src/applications/ponder/query/PonderQuestionSearchEngine.php
··· 12 12 } 13 13 14 14 public function newQuery() { 15 - return new PonderQuestionQuery(); 15 + return id(new PonderQuestionQuery()) 16 + ->needProjectPHIDs(true); 16 17 } 17 18 18 19 protected function buildQueryFromParameters(array $map) { ··· 112 113 113 114 $viewer = $this->requireViewer(); 114 115 116 + $proj_phids = array(); 117 + foreach ($questions as $question) { 118 + foreach ($question->getProjectPHIDs() as $project_phid) { 119 + $proj_phids[] = $project_phid; 120 + } 121 + } 122 + 123 + $proj_handles = id(new PhabricatorHandleQuery()) 124 + ->setViewer($viewer) 125 + ->withPHIDs($proj_phids) 126 + ->execute(); 127 + 115 128 $view = id(new PHUIObjectItemListView()) 116 129 ->setUser($viewer); 117 130 ··· 129 142 $item->setObject($question); 130 143 $item->setStatusIcon($icon.' '.$color, $full_status); 131 144 145 + $project_handles = array_select_keys( 146 + $proj_handles, 147 + $question->getProjectPHIDs()); 148 + 132 149 $created_date = phabricator_date($question->getDateCreated(), $viewer); 133 150 $item->addIcon('none', $created_date); 134 151 $item->addByline( ··· 138 155 139 156 $item->addAttribute( 140 157 pht('%d Answer(s)', $question->getAnswerCount())); 158 + 159 + if ($project_handles) { 160 + $item->addAttribute( 161 + id(new PHUIHandleTagListView()) 162 + ->setLimit(4) 163 + ->setSlim(true) 164 + ->setHandles($project_handles)); 165 + } 141 166 142 167 $view->addItem($item); 143 168 }
+11
src/applications/ponder/storage/PonderQuestion.php
··· 33 33 private $vote; 34 34 private $comments; 35 35 36 + private $projectPHIDs = self::ATTACHABLE; 37 + 36 38 public static function initializeNewQuestion(PhabricatorUser $actor) { 37 39 $app = id(new PhabricatorApplicationQuery()) 38 40 ->setViewer($actor) ··· 162 164 163 165 public function getAnswers() { 164 166 return $this->answers; 167 + } 168 + 169 + public function getProjectPHIDs() { 170 + return $this->assertAttached($this->projectPHIDs); 171 + } 172 + 173 + public function attachProjectPHIDs(array $phids) { 174 + $this->projectPHIDs = $phids; 175 + return $this; 165 176 } 166 177 167 178 public function getMarkupField() {
+2
src/infrastructure/internationalization/translation/PhabricatorUSEnglishTranslation.php
··· 32 32 '%d path(s)' => array('%d path', '%d paths'), 33 33 '%d diff(s)' => array('%d diff', '%d diffs'), 34 34 35 + '%d Answer(s)' => array('%d Answer', '%d Answers'), 36 + 35 37 '%s DIFF LINK(S)' => array('DIFF LINK', 'DIFF LINKS'), 36 38 'You successfully created %d diff(s).' => array( 37 39 'You successfully created %d diff.',