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

Projects for DifferentialRevision

Summary: T2628, Adding project tags to revisions

Test Plan: Edit revision, verify projects can be tagged. Add project hashtag to comments or commit templates, verify revision is tagged with project

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

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

authored by

lkassianik and committed by
epriestley
248b4dfa c1fab59f

+117 -1
+3
src/__phutil_library_map__.php
··· 415 415 'DifferentialPathField' => 'applications/differential/customfield/DifferentialPathField.php', 416 416 'DifferentialPrimaryPaneView' => 'applications/differential/view/DifferentialPrimaryPaneView.php', 417 417 'DifferentialProjectReviewersField' => 'applications/differential/customfield/DifferentialProjectReviewersField.php', 418 + 'DifferentialProjectsField' => 'applications/differential/customfield/DifferentialProjectsField.php', 418 419 'DifferentialRawDiffRenderer' => 'applications/differential/render/DifferentialRawDiffRenderer.php', 419 420 'DifferentialReleephRequestFieldSpecification' => 'applications/releeph/differential/DifferentialReleephRequestFieldSpecification.php', 420 421 'DifferentialRemarkupRule' => 'applications/differential/remarkup/DifferentialRemarkupRule.php', ··· 3108 3109 'DifferentialPathField' => 'DifferentialCustomField', 3109 3110 'DifferentialPrimaryPaneView' => 'AphrontView', 3110 3111 'DifferentialProjectReviewersField' => 'DifferentialCustomField', 3112 + 'DifferentialProjectsField' => 'DifferentialCoreCustomField', 3111 3113 'DifferentialRemarkupRule' => 'PhabricatorRemarkupRuleObject', 3112 3114 'DifferentialReplyHandler' => 'PhabricatorMailReplyHandler', 3113 3115 'DifferentialRepositoryField' => 'DifferentialCoreCustomField', ··· 3129 3131 7 => 'PhabricatorCustomFieldInterface', 3130 3132 8 => 'PhabricatorApplicationTransactionInterface', 3131 3133 9 => 'PhabricatorDestructableInterface', 3134 + 10 => 'PhabricatorProjectInterface', 3132 3135 ), 3133 3136 'DifferentialRevisionDetailView' => 'AphrontView', 3134 3137 'DifferentialRevisionEditController' => 'DifferentialController',
+1
src/applications/differential/config/PhabricatorDifferentialConfigOptions.php
··· 25 25 new DifferentialSubscribersField(), 26 26 new DifferentialRepositoryField(), 27 27 new DifferentialLintField(), 28 + new DifferentialProjectsField(), 28 29 new DifferentialUnitField(), 29 30 new DifferentialViewPolicyField(), 30 31 new DifferentialEditPolicyField(),
+111
src/applications/differential/customfield/DifferentialProjectsField.php
··· 1 + <?php 2 + 3 + final class DifferentialProjectsField 4 + extends DifferentialCoreCustomField { 5 + 6 + public function getFieldKey() { 7 + return 'phabricator:projects'; 8 + } 9 + 10 + public function getFieldName() { 11 + return pht('Projects'); 12 + } 13 + 14 + public function getFieldDescription() { 15 + return pht('Tag projects.'); 16 + } 17 + 18 + public function shouldAppearInPropertyView() { 19 + return false; 20 + } 21 + 22 + public function shouldAppearInEditView() { 23 + return true; 24 + } 25 + 26 + public function shouldAppearInApplicationTransactions() { 27 + return true; 28 + } 29 + 30 + protected function readValueFromRevision( 31 + DifferentialRevision $revision) { 32 + if (!$revision->getPHID()) { 33 + return array(); 34 + } 35 + 36 + $projects = PhabricatorEdgeQuery::loadDestinationPHIDs( 37 + $revision->getPHID(), 38 + PhabricatorEdgeConfig::TYPE_OBJECT_HAS_PROJECT); 39 + $projects = array_reverse($projects); 40 + 41 + return $projects; 42 + } 43 + 44 + public function getNewValueForApplicationTransactions() { 45 + return array('=' => array_fuse($this->getValue())); 46 + } 47 + 48 + public function readValueFromRequest(AphrontRequest $request) { 49 + $this->setValue($request->getArr($this->getFieldKey())); 50 + } 51 + 52 + public function getRequiredHandlePHIDsForEdit() { 53 + return $this->getValue(); 54 + } 55 + 56 + public function renderEditControl(array $handles) { 57 + return id(new AphrontFormTokenizerControl()) 58 + ->setName($this->getFieldKey()) 59 + ->setDatasource('/typeahead/common/projects/') 60 + ->setValue($handles) 61 + ->setLabel($this->getFieldName()); 62 + } 63 + 64 + public function getApplicationTransactionType() { 65 + return PhabricatorTransactions::TYPE_EDGE; 66 + } 67 + 68 + public function shouldAppearInCommitMessage() { 69 + return true; 70 + } 71 + 72 + public function shouldAllowEditInCommitMessage() { 73 + return true; 74 + } 75 + 76 + public function shouldOverwriteWhenCommitMessageIsEdited() { 77 + return true; 78 + } 79 + 80 + public function getCommitMessageLabels() { 81 + return array( 82 + 'Project', 83 + 'Projects', 84 + ); 85 + } 86 + 87 + public function getRequiredHandlePHIDsForCommitMessage() { 88 + return $this->getValue(); 89 + } 90 + 91 + public function renderCommitMessageValue(array $handles) { 92 + return $this->renderObjectList($handles); 93 + } 94 + 95 + public function shouldAppearInConduitDictionary() { 96 + return true; 97 + } 98 + 99 + public function getApplicationTransactionMetadata() { 100 + return array('edge:type' => PhabricatorEdgeConfig::TYPE_OBJECT_HAS_PROJECT); 101 + } 102 + 103 + public function parseValueFromCommitMessage($value) { 104 + return $this->parseObjectList( 105 + $value, 106 + array( 107 + PhabricatorProjectPHIDTypeProject::TYPECONST, 108 + )); 109 + } 110 + 111 + }
+2 -1
src/applications/differential/storage/DifferentialRevision.php
··· 10 10 PhabricatorSubscribableInterface, 11 11 PhabricatorCustomFieldInterface, 12 12 PhabricatorApplicationTransactionInterface, 13 - PhabricatorDestructableInterface { 13 + PhabricatorDestructableInterface, 14 + PhabricatorProjectInterface { 14 15 15 16 protected $title = ''; 16 17 protected $originalTitle;