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

Use Application PHIDs in Ponder

Summary: Ref T2715. Switch Ponder to the new IDs.

Test Plan: Ran `phid.lookup`; `phid.query`. Grepped for old constant

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T2715

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

+80 -33
+2
src/__phutil_library_map__.php
··· 1864 1864 'PonderDAO' => 'applications/ponder/storage/PonderDAO.php', 1865 1865 'PonderMail' => 'applications/ponder/mail/PonderMail.php', 1866 1866 'PonderMentionMail' => 'applications/ponder/mail/PonderMentionMail.php', 1867 + 'PonderPHIDTypeQuestion' => 'applications/ponder/phid/PonderPHIDTypeQuestion.php', 1867 1868 'PonderPostBodyView' => 'applications/ponder/view/PonderPostBodyView.php', 1868 1869 'PonderQuestion' => 'applications/ponder/storage/PonderQuestion.php', 1869 1870 'PonderQuestionAskController' => 'applications/ponder/controller/PonderQuestionAskController.php', ··· 3945 3946 'PonderDAO' => 'PhabricatorLiskDAO', 3946 3947 'PonderMail' => 'PhabricatorMail', 3947 3948 'PonderMentionMail' => 'PonderMail', 3949 + 'PonderPHIDTypeQuestion' => 'PhabricatorPHIDType', 3948 3950 'PonderPostBodyView' => 'AphrontView', 3949 3951 'PonderQuestion' => 3950 3952 array(
-1
src/applications/phid/PhabricatorObjectHandle.php
··· 113 113 PhabricatorPHIDConstants::PHID_TYPE_PIMG => 'Pholio Image', 114 114 PhabricatorPHIDConstants::PHID_TYPE_BLOG => 'Blog', 115 115 PhabricatorPHIDConstants::PHID_TYPE_POST => 'Post', 116 - PhabricatorPHIDConstants::PHID_TYPE_QUES => 'Question', 117 116 PhabricatorPHIDConstants::PHID_TYPE_PVAR => 'Variable', 118 117 PhabricatorPHIDConstants::PHID_TYPE_PSTE => 'Paste', 119 118 PhabricatorPHIDConstants::PHID_TYPE_LEGD => 'Legalpad Document',
-1
src/applications/phid/PhabricatorPHIDConstants.php
··· 17 17 const PHID_TYPE_POST = 'POST'; 18 18 const PHID_TYPE_TOBJ = 'TOBJ'; 19 19 const PHID_TYPE_BLOG = 'BLOG'; 20 - const PHID_TYPE_QUES = 'QUES'; 21 20 const PHID_TYPE_ANSW = 'ANSW'; 22 21 const PHID_TYPE_PIMG = 'PIMG'; 23 22 const PHID_TYPE_MCRO = 'MCRO';
-26
src/applications/phid/handle/PhabricatorObjectHandleData.php
··· 68 68 $phids); 69 69 return mpull($projects, null, 'getPHID'); 70 70 71 - case PhabricatorPHIDConstants::PHID_TYPE_QUES: 72 - $questions = id(new PonderQuestionQuery()) 73 - ->setViewer($this->viewer) 74 - ->withPHIDs($phids) 75 - ->execute(); 76 - return mpull($questions, null, 'getPHID'); 77 - 78 71 case PhabricatorPHIDConstants::PHID_TYPE_PIMG: 79 72 $images = id(new PholioImage()) 80 73 ->loadAllWhere('phid IN (%Ls)', $phids); ··· 294 287 } else { 295 288 $project = $objects[$phid]; 296 289 $handle->setName($project->getName()); 297 - $handle->setComplete(true); 298 - } 299 - $handles[$phid] = $handle; 300 - } 301 - break; 302 - 303 - case PhabricatorPHIDConstants::PHID_TYPE_QUES: 304 - foreach ($phids as $phid) { 305 - $handle = new PhabricatorObjectHandle(); 306 - $handle->setPHID($phid); 307 - $handle->setType($type); 308 - if (empty($objects[$phid])) { 309 - $handle->setName('Unknown Ponder Question'); 310 - } else { 311 - $question = $objects[$phid]; 312 - $handle->setName('Q' . $question->getID()); 313 - $handle->setFullName( 314 - phutil_utf8_shorten($question->getTitle(), 60)); 315 - $handle->setURI(new PhutilURI('/Q' . $question->getID())); 316 290 $handle->setComplete(true); 317 291 } 318 292 $handles[$phid] = $handle;
+75
src/applications/ponder/phid/PonderPHIDTypeQuestion.php
··· 1 + <?php 2 + 3 + final class PonderPHIDTypeQuestion extends PhabricatorPHIDType { 4 + 5 + const TYPECONST = 'QUES'; 6 + 7 + public function getTypeConstant() { 8 + return self::TYPECONST; 9 + } 10 + 11 + public function getTypeName() { 12 + return pht('Question'); 13 + } 14 + 15 + public function newObject() { 16 + return new PonderQuestion(); 17 + } 18 + 19 + public function loadObjects( 20 + PhabricatorObjectQuery $query, 21 + array $phids) { 22 + 23 + return id(new PonderQuestionQuery()) 24 + ->setViewer($query->getViewer()) 25 + ->withPHIDs($phids) 26 + ->execute(); 27 + } 28 + 29 + public function loadHandles( 30 + PhabricatorHandleQuery $query, 31 + array $handles, 32 + array $objects) { 33 + 34 + foreach ($handles as $phid => $handle) { 35 + $question = $objects[$phid]; 36 + 37 + $id = $question->getID(); 38 + $title = $question->getTitle(); 39 + 40 + $handle->setName("Q{$id}"); 41 + $handle->setURI("/Q{$id}"); 42 + $handle->setFullName("Q{$id}: {$title}"); 43 + } 44 + } 45 + 46 + public function canLoadNamedObject($name) { 47 + return preg_match('/^Q\d*[1-9]\d*$/', $name); 48 + } 49 + 50 + public function loadNamedObjects( 51 + PhabricatorObjectQuery $query, 52 + array $names) { 53 + 54 + $id_map = array(); 55 + foreach ($names as $name) { 56 + $id = (int)substr($name, 1); 57 + $id_map[$id][] = $name; 58 + } 59 + 60 + $objects = id(new PonderQuestionQuery()) 61 + ->setViewer($query->getViewer()) 62 + ->withIDs(array_keys($id_map)) 63 + ->execute(); 64 + 65 + $results = array(); 66 + foreach ($objects as $id => $object) { 67 + foreach (idx($id_map, $id, array()) as $name) { 68 + $results[$name] = $object; 69 + } 70 + } 71 + 72 + return $results; 73 + } 74 + 75 + }
+1 -1
src/applications/ponder/search/PonderSearchIndexer.php
··· 14 14 15 15 $doc = new PhabricatorSearchAbstractDocument(); 16 16 $doc->setPHID($question->getPHID()); 17 - $doc->setDocumentType(PhabricatorPHIDConstants::PHID_TYPE_QUES); 17 + $doc->setDocumentType(PonderPHIDTypeQuestion::TYPECONST); 18 18 $doc->setDocumentTitle($question->getTitle()); 19 19 $doc->setDocumentCreated($question->getDateCreated()); 20 20 $doc->setDocumentModified($question->getDateModified());
+1 -2
src/applications/ponder/storage/PonderQuestion.php
··· 33 33 } 34 34 35 35 public function generatePHID() { 36 - return PhabricatorPHID::generateNewPHID( 37 - PhabricatorPHIDConstants::PHID_TYPE_QUES); 36 + return PhabricatorPHID::generateNewPHID(PonderPHIDTypeQuestion::TYPECONST); 38 37 } 39 38 40 39 public function setContentSource(PhabricatorContentSource $content_source) {
+1 -1
src/applications/search/index/PhabricatorSearchAbstractDocument.php
··· 20 20 ManiphestPHIDTypeTask::TYPECONST => 'Maniphest Tasks', 21 21 PhrictionPHIDTypeDocument::TYPECONST => 'Phriction Documents', 22 22 PhabricatorPHIDConstants::PHID_TYPE_USER => 'Phabricator Users', 23 - PhabricatorPHIDConstants::PHID_TYPE_QUES => 'Ponder Questions', 23 + PonderPHIDTypeQuestion::TYPECONST => 'Ponder Questions', 24 24 ); 25 25 } 26 26
-1
src/infrastructure/edges/constants/PhabricatorEdgeConfig.php
··· 158 158 PhabricatorPHIDConstants::PHID_TYPE_TOBJ => 'HarbormasterObject', 159 159 PhabricatorPHIDConstants::PHID_TYPE_BLOG => 'PhameBlog', 160 160 PhabricatorPHIDConstants::PHID_TYPE_POST => 'PhamePost', 161 - PhabricatorPHIDConstants::PHID_TYPE_QUES => 'PonderQuestion', 162 161 PhabricatorPHIDConstants::PHID_TYPE_ANSW => 'PonderAnswer', 163 162 PhabricatorPHIDConstants::PHID_TYPE_MCRO => 'PhabricatorFileImageMacro', 164 163 PhabricatorPHIDConstants::PHID_TYPE_CONP => 'ConpherenceThread',