diff --git a/resources/sql/autopatches/20170301.subtype.03.taskcol.sql b/resources/sql/autopatches/20170301.subtype.03.taskcol.sql new file mode 100644 --- /dev/null +++ b/resources/sql/autopatches/20170301.subtype.03.taskcol.sql @@ -0,0 +1,2 @@ +ALTER TABLE {$NAMESPACE}_maniphest.maniphest_task + ADD subtype VARCHAR(64) COLLATE {$COLLATE_TEXT} NOT NULL; diff --git a/resources/sql/autopatches/20170301.subtype.04.taskdefault.sql b/resources/sql/autopatches/20170301.subtype.04.taskdefault.sql new file mode 100644 --- /dev/null +++ b/resources/sql/autopatches/20170301.subtype.04.taskdefault.sql @@ -0,0 +1,2 @@ +UPDATE {$NAMESPACE}_maniphest.maniphest_task + SET subtype = 'default' WHERE subtype = ''; 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 @@ -2626,6 +2626,7 @@ 'PhabricatorEditEngineSettingsPanel' => 'applications/settings/panel/PhabricatorEditEngineSettingsPanel.php', 'PhabricatorEditEngineStaticCommentAction' => 'applications/transactions/commentaction/PhabricatorEditEngineStaticCommentAction.php', 'PhabricatorEditEngineSubtype' => 'applications/transactions/editengine/PhabricatorEditEngineSubtype.php', + 'PhabricatorEditEngineSubtypeInterface' => 'applications/transactions/editengine/PhabricatorEditEngineSubtypeInterface.php', 'PhabricatorEditEngineSubtypeTestCase' => 'applications/transactions/editengine/__tests__/PhabricatorEditEngineSubtypeTestCase.php', 'PhabricatorEditEngineTokenizerCommentAction' => 'applications/transactions/commentaction/PhabricatorEditEngineTokenizerCommentAction.php', 'PhabricatorEditField' => 'applications/transactions/editfield/PhabricatorEditField.php', @@ -6367,6 +6368,7 @@ 'PhabricatorConduitResultInterface', 'PhabricatorFulltextInterface', 'DoorkeeperBridgedObjectInterface', + 'PhabricatorEditEngineSubtypeInterface', ), 'ManiphestTaskAssignHeraldAction' => 'HeraldAction', 'ManiphestTaskAssignOtherHeraldAction' => 'ManiphestTaskAssignHeraldAction', diff --git a/src/applications/maniphest/query/ManiphestTaskQuery.php b/src/applications/maniphest/query/ManiphestTaskQuery.php --- a/src/applications/maniphest/query/ManiphestTaskQuery.php +++ b/src/applications/maniphest/query/ManiphestTaskQuery.php @@ -24,6 +24,7 @@ private $hasOpenSubtasks; private $parentTaskIDs; private $subtaskIDs; + private $subtypes; private $fullTextSearch = ''; @@ -208,6 +209,11 @@ return $this; } + public function withSubtypes(array $subtypes) { + $this->subtypes = $subtypes; + return $this; + } + public function newResultObject() { return new ManiphestTask(); } @@ -423,6 +429,13 @@ $this->bridgedObjectPHIDs); } + if ($this->subtypes !== null) { + $where[] = qsprintf( + $conn, + 'task.subtype IN (%Ls)', + $this->subtypes); + } + return $where; } diff --git a/src/applications/maniphest/storage/ManiphestTask.php b/src/applications/maniphest/storage/ManiphestTask.php --- a/src/applications/maniphest/storage/ManiphestTask.php +++ b/src/applications/maniphest/storage/ManiphestTask.php @@ -16,7 +16,8 @@ PhabricatorSpacesInterface, PhabricatorConduitResultInterface, PhabricatorFulltextInterface, - DoorkeeperBridgedObjectInterface { + DoorkeeperBridgedObjectInterface, + PhabricatorEditEngineSubtypeInterface { const MARKUP_FIELD_DESCRIPTION = 'markup:desc'; @@ -40,6 +41,7 @@ protected $bridgedObjectPHID; protected $properties = array(); protected $points; + protected $subtype; private $subscriberPHIDs = self::ATTACHABLE; private $groupByProjectPHID = self::ATTACHABLE; @@ -63,6 +65,7 @@ ->setViewPolicy($view_policy) ->setEditPolicy($edit_policy) ->setSpacePHID($actor->getDefaultSpacePHID()) + ->setSubtype(PhabricatorEditEngineSubtype::SUBTYPE_DEFAULT) ->attachProjectPHIDs(array()) ->attachSubscriberPHIDs(array()); } @@ -86,6 +89,7 @@ 'subpriority' => 'double', 'points' => 'double?', 'bridgedObjectPHID' => 'phid?', + 'subtype' => 'text64', ), self::CONFIG_KEY_SCHEMA => array( 'key_phid' => null, @@ -124,6 +128,9 @@ 'columns' => array('bridgedObjectPHID'), 'unique' => true, ), + 'key_subtype' => array( + 'columns' => array('subtype'), + ), ), ) + parent::getConfiguration(); } @@ -474,6 +481,10 @@ ->setKey('points') ->setType('points') ->setDescription(pht('Point value of the task.')), + id(new PhabricatorConduitSearchFieldSpecification()) + ->setKey('subtype') + ->setType('string') + ->setDescription(pht('Subtype of the task.')), ); } @@ -501,6 +512,7 @@ 'status' => $status_info, 'priority' => $priority_info, 'points' => $this->getPoints(), + 'subtype' => $this->getSubtype(), ); } @@ -533,4 +545,16 @@ return $this; } + +/* -( PhabricatorEditEngineSubtypeInterface )------------------------------ */ + + + public function getEditEngineSubtype() { + return $this->getSubtype(); + } + + public function setEditEngineSubtype($value) { + return $this->setSubtype($value); + } + } diff --git a/src/applications/transactions/editengine/PhabricatorEditEngineSubtypeInterface.php b/src/applications/transactions/editengine/PhabricatorEditEngineSubtypeInterface.php new file mode 100644 --- /dev/null +++ b/src/applications/transactions/editengine/PhabricatorEditEngineSubtypeInterface.php @@ -0,0 +1,8 @@ +