Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15447989
D9686.id23241.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
5 KB
Referenced Files
None
Subscribers
None
D9686.id23241.diff
View Options
diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -415,6 +415,7 @@
'DifferentialPathField' => 'applications/differential/customfield/DifferentialPathField.php',
'DifferentialPrimaryPaneView' => 'applications/differential/view/DifferentialPrimaryPaneView.php',
'DifferentialProjectReviewersField' => 'applications/differential/customfield/DifferentialProjectReviewersField.php',
+ 'DifferentialProjectsField' => 'applications/differential/customfield/DifferentialProjectsField.php',
'DifferentialRawDiffRenderer' => 'applications/differential/render/DifferentialRawDiffRenderer.php',
'DifferentialReleephRequestFieldSpecification' => 'applications/releeph/differential/DifferentialReleephRequestFieldSpecification.php',
'DifferentialRemarkupRule' => 'applications/differential/remarkup/DifferentialRemarkupRule.php',
@@ -3108,6 +3109,7 @@
'DifferentialPathField' => 'DifferentialCustomField',
'DifferentialPrimaryPaneView' => 'AphrontView',
'DifferentialProjectReviewersField' => 'DifferentialCustomField',
+ 'DifferentialProjectsField' => 'DifferentialCoreCustomField',
'DifferentialRemarkupRule' => 'PhabricatorRemarkupRuleObject',
'DifferentialReplyHandler' => 'PhabricatorMailReplyHandler',
'DifferentialRepositoryField' => 'DifferentialCoreCustomField',
@@ -3129,6 +3131,7 @@
7 => 'PhabricatorCustomFieldInterface',
8 => 'PhabricatorApplicationTransactionInterface',
9 => 'PhabricatorDestructableInterface',
+ 10 => 'PhabricatorProjectInterface',
),
'DifferentialRevisionDetailView' => 'AphrontView',
'DifferentialRevisionEditController' => 'DifferentialController',
diff --git a/src/applications/differential/config/PhabricatorDifferentialConfigOptions.php b/src/applications/differential/config/PhabricatorDifferentialConfigOptions.php
--- a/src/applications/differential/config/PhabricatorDifferentialConfigOptions.php
+++ b/src/applications/differential/config/PhabricatorDifferentialConfigOptions.php
@@ -25,6 +25,7 @@
new DifferentialSubscribersField(),
new DifferentialRepositoryField(),
new DifferentialLintField(),
+ new DifferentialProjectsField(),
new DifferentialUnitField(),
new DifferentialViewPolicyField(),
new DifferentialEditPolicyField(),
diff --git a/src/applications/differential/customfield/DifferentialProjectsField.php b/src/applications/differential/customfield/DifferentialProjectsField.php
new file mode 100644
--- /dev/null
+++ b/src/applications/differential/customfield/DifferentialProjectsField.php
@@ -0,0 +1,111 @@
+<?php
+
+final class DifferentialProjectsField
+ extends DifferentialCoreCustomField {
+
+ public function getFieldKey() {
+ return 'phabricator:projects';
+ }
+
+ public function getFieldName() {
+ return pht('Projects');
+ }
+
+ public function getFieldDescription() {
+ return pht('Tag projects.');
+ }
+
+ public function shouldAppearInPropertyView() {
+ return false;
+ }
+
+ public function shouldAppearInEditView() {
+ return true;
+ }
+
+ public function shouldAppearInApplicationTransactions() {
+ return true;
+ }
+
+ protected function readValueFromRevision(
+ DifferentialRevision $revision) {
+ if (!$revision->getPHID()) {
+ return array();
+ }
+
+ $projects = PhabricatorEdgeQuery::loadDestinationPHIDs(
+ $revision->getPHID(),
+ PhabricatorEdgeConfig::TYPE_OBJECT_HAS_PROJECT);
+ $projects = array_reverse($projects);
+
+ return $projects;
+ }
+
+ public function getNewValueForApplicationTransactions() {
+ return array('=' => array_fuse($this->getValue()));
+ }
+
+ public function readValueFromRequest(AphrontRequest $request) {
+ $this->setValue($request->getArr($this->getFieldKey()));
+ }
+
+ public function getRequiredHandlePHIDsForEdit() {
+ return $this->getValue();
+ }
+
+ public function renderEditControl(array $handles) {
+ return id(new AphrontFormTokenizerControl())
+ ->setName($this->getFieldKey())
+ ->setDatasource('/typeahead/common/projects/')
+ ->setValue($handles)
+ ->setLabel($this->getFieldName());
+ }
+
+ public function getApplicationTransactionType() {
+ return PhabricatorTransactions::TYPE_EDGE;
+ }
+
+ public function shouldAppearInCommitMessage() {
+ return true;
+ }
+
+ public function shouldAllowEditInCommitMessage() {
+ return true;
+ }
+
+ public function shouldOverwriteWhenCommitMessageIsEdited() {
+ return true;
+ }
+
+ public function getCommitMessageLabels() {
+ return array(
+ 'Project',
+ 'Projects',
+ );
+ }
+
+ public function getRequiredHandlePHIDsForCommitMessage() {
+ return $this->getValue();
+ }
+
+ public function renderCommitMessageValue(array $handles) {
+ return $this->renderObjectList($handles);
+ }
+
+ public function shouldAppearInConduitDictionary() {
+ return true;
+ }
+
+ public function getApplicationTransactionMetadata() {
+ return array('edge:type' => PhabricatorEdgeConfig::TYPE_OBJECT_HAS_PROJECT);
+ }
+
+ public function parseValueFromCommitMessage($value) {
+ return $this->parseObjectList(
+ $value,
+ array(
+ PhabricatorProjectPHIDTypeProject::TYPECONST,
+ ));
+ }
+
+}
diff --git a/src/applications/differential/storage/DifferentialRevision.php b/src/applications/differential/storage/DifferentialRevision.php
--- a/src/applications/differential/storage/DifferentialRevision.php
+++ b/src/applications/differential/storage/DifferentialRevision.php
@@ -10,7 +10,8 @@
PhabricatorSubscribableInterface,
PhabricatorCustomFieldInterface,
PhabricatorApplicationTransactionInterface,
- PhabricatorDestructableInterface {
+ PhabricatorDestructableInterface,
+ PhabricatorProjectInterface {
protected $title = '';
protected $originalTitle;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Mar 29, 2:43 AM (6 d, 20 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7499678
Default Alt Text
D9686.id23241.diff (5 KB)
Attached To
Mode
D9686: Projects for DifferentialRevision
Attached
Detach File
Event Timeline
Log In to Comment