@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 project tags to PonderQuestion

Summary: T2628, adding project tags to ponder questions

Test Plan: Create ponder question, add project tag, save, project tag should show in question properties on question view.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

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

authored by

lkassianik and committed by
epriestley
0bdf18fd 6df8c4a4

+35 -6
+31 -5
src/applications/ponder/controller/PonderQuestionEditController.php
··· 25 25 if (!$question) { 26 26 return new Aphront404Response(); 27 27 } 28 + $v_projects = PhabricatorEdgeQuery::loadDestinationPHIDs( 29 + $question->getPHID(), 30 + PhabricatorEdgeConfig::TYPE_OBJECT_HAS_PROJECT); 31 + $v_projects = array_reverse($v_projects); 28 32 } else { 29 33 $question = id(new PonderQuestion()) 30 34 ->setStatus(PonderQuestionStatus::STATUS_OPEN) ··· 32 36 ->setVoteCount(0) 33 37 ->setAnswerCount(0) 34 38 ->setHeat(0.0); 39 + $v_projects = array(); 35 40 } 36 41 37 42 $v_title = $question->getTitle(); ··· 42 47 if ($request->isFormPost()) { 43 48 $v_title = $request->getStr('title'); 44 49 $v_content = $request->getStr('content'); 50 + $v_projects = $request->getArr('projects'); 45 51 46 52 $len = phutil_utf8_strlen($v_title); 47 53 if ($len < 1) { ··· 64 70 ->setTransactionType(PonderQuestionTransaction::TYPE_CONTENT) 65 71 ->setNewValue($v_content); 66 72 73 + $proj_edge_type = PhabricatorEdgeConfig::TYPE_OBJECT_HAS_PROJECT; 74 + $xactions[] = id(new PonderQuestionTransaction()) 75 + ->setTransactionType(PhabricatorTransactions::TYPE_EDGE) 76 + ->setMetadataValue('edge:type', $proj_edge_type) 77 + ->setNewValue(array('=' => array_fuse($v_projects))); 78 + 67 79 $editor = id(new PonderQuestionEditor()) 68 80 ->setActor($user) 69 81 ->setContentSourceFromRequest($request) ··· 90 102 ->setID('content') 91 103 ->setValue($v_content) 92 104 ->setLabel(pht('Description')) 93 - ->setUser($user)) 94 - ->appendChild( 95 - id(new AphrontFormSubmitControl()) 96 - ->addCancelButton($this->getApplicationURI()) 97 - ->setValue(pht('Ask Away!'))); 105 + ->setUser($user)); 106 + 107 + if ($v_projects) { 108 + $project_handles = $this->loadViewerHandles($v_projects); 109 + } else { 110 + $project_handles = array(); 111 + } 112 + 113 + $form->appendChild( 114 + id(new AphrontFormTokenizerControl()) 115 + ->setLabel(pht('Projects')) 116 + ->setName('projects') 117 + ->setValue($project_handles) 118 + ->setDatasource('/typeahead/common/projects/')); 119 + 120 + $form ->appendChild( 121 + id(new AphrontFormSubmitControl()) 122 + ->addCancelButton($this->getApplicationURI()) 123 + ->setValue(pht('Ask Away!'))); 98 124 99 125 $preview = id(new PHUIRemarkupPreviewPanel()) 100 126 ->setHeader(pht('Question Preview'))
+2
src/applications/ponder/editor/PonderQuestionEditor.php
··· 141 141 142 142 $object->setAnswerCount($count); 143 143 break; 144 + case PhabricatorTransactions::TYPE_EDGE: 145 + return; 144 146 } 145 147 } 146 148
+2 -1
src/applications/ponder/storage/PonderQuestion.php
··· 7 7 PhabricatorSubscribableInterface, 8 8 PhabricatorFlaggableInterface, 9 9 PhabricatorPolicyInterface, 10 - PhabricatorTokenReceiverInterface { 10 + PhabricatorTokenReceiverInterface, 11 + PhabricatorProjectInterface { 11 12 12 13 const MARKUP_FIELD_CONTENT = 'markup:content'; 13 14