Skip to content

Commit dc7ecf5

Browse files
author
epriestley
committedMar 2, 2017
Add "subtype" storage to Maniphest tasks
Summary: Ref T12314. Provides a field on tasks for storing subtypes. Does nothing interesting yet. Test Plan: - Ran storage upgrade. - Created some tasks. - Looked in the database. - Used Conduit to query some tasks. Reviewers: chad Reviewed By: chad Maniphest Tasks: T12314 Differential Revision: https://secure.phabricator.com/D17441
1 parent 1b96f2f commit dc7ecf5

File tree

6 files changed

+52
-1
lines changed

6 files changed

+52
-1
lines changed
 
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
ALTER TABLE {$NAMESPACE}_maniphest.maniphest_task
2+
ADD subtype VARCHAR(64) COLLATE {$COLLATE_TEXT} NOT NULL;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
UPDATE {$NAMESPACE}_maniphest.maniphest_task
2+
SET subtype = 'default' WHERE subtype = '';

‎src/__phutil_library_map__.php

+2
Original file line numberDiff line numberDiff line change
@@ -2626,6 +2626,7 @@
26262626
'PhabricatorEditEngineSettingsPanel' => 'applications/settings/panel/PhabricatorEditEngineSettingsPanel.php',
26272627
'PhabricatorEditEngineStaticCommentAction' => 'applications/transactions/commentaction/PhabricatorEditEngineStaticCommentAction.php',
26282628
'PhabricatorEditEngineSubtype' => 'applications/transactions/editengine/PhabricatorEditEngineSubtype.php',
2629+
'PhabricatorEditEngineSubtypeInterface' => 'applications/transactions/editengine/PhabricatorEditEngineSubtypeInterface.php',
26292630
'PhabricatorEditEngineSubtypeTestCase' => 'applications/transactions/editengine/__tests__/PhabricatorEditEngineSubtypeTestCase.php',
26302631
'PhabricatorEditEngineTokenizerCommentAction' => 'applications/transactions/commentaction/PhabricatorEditEngineTokenizerCommentAction.php',
26312632
'PhabricatorEditField' => 'applications/transactions/editfield/PhabricatorEditField.php',
@@ -6367,6 +6368,7 @@
63676368
'PhabricatorConduitResultInterface',
63686369
'PhabricatorFulltextInterface',
63696370
'DoorkeeperBridgedObjectInterface',
6371+
'PhabricatorEditEngineSubtypeInterface',
63706372
),
63716373
'ManiphestTaskAssignHeraldAction' => 'HeraldAction',
63726374
'ManiphestTaskAssignOtherHeraldAction' => 'ManiphestTaskAssignHeraldAction',

‎src/applications/maniphest/query/ManiphestTaskQuery.php

+13
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ final class ManiphestTaskQuery extends PhabricatorCursorPagedPolicyAwareQuery {
2424
private $hasOpenSubtasks;
2525
private $parentTaskIDs;
2626
private $subtaskIDs;
27+
private $subtypes;
2728

2829
private $fullTextSearch = '';
2930

@@ -208,6 +209,11 @@ public function withBridgedObjectPHIDs(array $phids) {
208209
return $this;
209210
}
210211

212+
public function withSubtypes(array $subtypes) {
213+
$this->subtypes = $subtypes;
214+
return $this;
215+
}
216+
211217
public function newResultObject() {
212218
return new ManiphestTask();
213219
}
@@ -423,6 +429,13 @@ protected function buildWhereClauseParts(AphrontDatabaseConnection $conn) {
423429
$this->bridgedObjectPHIDs);
424430
}
425431

432+
if ($this->subtypes !== null) {
433+
$where[] = qsprintf(
434+
$conn,
435+
'task.subtype IN (%Ls)',
436+
$this->subtypes);
437+
}
438+
426439
return $where;
427440
}
428441

‎src/applications/maniphest/storage/ManiphestTask.php

+25-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ final class ManiphestTask extends ManiphestDAO
1616
PhabricatorSpacesInterface,
1717
PhabricatorConduitResultInterface,
1818
PhabricatorFulltextInterface,
19-
DoorkeeperBridgedObjectInterface {
19+
DoorkeeperBridgedObjectInterface,
20+
PhabricatorEditEngineSubtypeInterface {
2021

2122
const MARKUP_FIELD_DESCRIPTION = 'markup:desc';
2223

@@ -40,6 +41,7 @@ final class ManiphestTask extends ManiphestDAO
4041
protected $bridgedObjectPHID;
4142
protected $properties = array();
4243
protected $points;
44+
protected $subtype;
4345

4446
private $subscriberPHIDs = self::ATTACHABLE;
4547
private $groupByProjectPHID = self::ATTACHABLE;
@@ -63,6 +65,7 @@ public static function initializeNewTask(PhabricatorUser $actor) {
6365
->setViewPolicy($view_policy)
6466
->setEditPolicy($edit_policy)
6567
->setSpacePHID($actor->getDefaultSpacePHID())
68+
->setSubtype(PhabricatorEditEngineSubtype::SUBTYPE_DEFAULT)
6669
->attachProjectPHIDs(array())
6770
->attachSubscriberPHIDs(array());
6871
}
@@ -86,6 +89,7 @@ protected function getConfiguration() {
8689
'subpriority' => 'double',
8790
'points' => 'double?',
8891
'bridgedObjectPHID' => 'phid?',
92+
'subtype' => 'text64',
8993
),
9094
self::CONFIG_KEY_SCHEMA => array(
9195
'key_phid' => null,
@@ -124,6 +128,9 @@ protected function getConfiguration() {
124128
'columns' => array('bridgedObjectPHID'),
125129
'unique' => true,
126130
),
131+
'key_subtype' => array(
132+
'columns' => array('subtype'),
133+
),
127134
),
128135
) + parent::getConfiguration();
129136
}
@@ -474,6 +481,10 @@ public function getFieldSpecificationsForConduit() {
474481
->setKey('points')
475482
->setType('points')
476483
->setDescription(pht('Point value of the task.')),
484+
id(new PhabricatorConduitSearchFieldSpecification())
485+
->setKey('subtype')
486+
->setType('string')
487+
->setDescription(pht('Subtype of the task.')),
477488
);
478489
}
479490

@@ -501,6 +512,7 @@ public function getFieldValuesForConduit() {
501512
'status' => $status_info,
502513
'priority' => $priority_info,
503514
'points' => $this->getPoints(),
515+
'subtype' => $this->getSubtype(),
504516
);
505517
}
506518

@@ -533,4 +545,16 @@ public function attachBridgedObject(
533545
return $this;
534546
}
535547

548+
549+
/* -( PhabricatorEditEngineSubtypeInterface )------------------------------ */
550+
551+
552+
public function getEditEngineSubtype() {
553+
return $this->getSubtype();
554+
}
555+
556+
public function setEditEngineSubtype($value) {
557+
return $this->setSubtype($value);
558+
}
559+
536560
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?php
2+
3+
interface PhabricatorEditEngineSubtypeInterface {
4+
5+
public function getEditEngineSubtype();
6+
public function setEditEngineSubtype($subtype);
7+
8+
}

0 commit comments

Comments
 (0)
Failed to load comments.