diff --git a/resources/sql/autopatches/20170301.subtype.03.taskcol.sql b/resources/sql/autopatches/20170301.subtype.03.taskcol.sql new file mode 100644 index 0000000000..7c4f6c9412 --- /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 index 0000000000..7189bdb26e --- /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 index 10aa9b872d..ca4d9978c4 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -2626,6 +2626,7 @@ phutil_register_library_map(array( '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 @@ phutil_register_library_map(array( 'PhabricatorConduitResultInterface', 'PhabricatorFulltextInterface', 'DoorkeeperBridgedObjectInterface', + 'PhabricatorEditEngineSubtypeInterface', ), 'ManiphestTaskAssignHeraldAction' => 'HeraldAction', 'ManiphestTaskAssignOtherHeraldAction' => 'ManiphestTaskAssignHeraldAction', diff --git a/src/applications/maniphest/query/ManiphestTaskQuery.php b/src/applications/maniphest/query/ManiphestTaskQuery.php index 8d2fe79735..d95fd8c2cf 100644 --- a/src/applications/maniphest/query/ManiphestTaskQuery.php +++ b/src/applications/maniphest/query/ManiphestTaskQuery.php @@ -24,6 +24,7 @@ final class ManiphestTaskQuery extends PhabricatorCursorPagedPolicyAwareQuery { private $hasOpenSubtasks; private $parentTaskIDs; private $subtaskIDs; + private $subtypes; private $fullTextSearch = ''; @@ -208,6 +209,11 @@ final class ManiphestTaskQuery extends PhabricatorCursorPagedPolicyAwareQuery { return $this; } + public function withSubtypes(array $subtypes) { + $this->subtypes = $subtypes; + return $this; + } + public function newResultObject() { return new ManiphestTask(); } @@ -423,6 +429,13 @@ final class ManiphestTaskQuery extends PhabricatorCursorPagedPolicyAwareQuery { $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 index 76722f6719..aa59378e20 100644 --- a/src/applications/maniphest/storage/ManiphestTask.php +++ b/src/applications/maniphest/storage/ManiphestTask.php @@ -16,7 +16,8 @@ final class ManiphestTask extends ManiphestDAO PhabricatorSpacesInterface, PhabricatorConduitResultInterface, PhabricatorFulltextInterface, - DoorkeeperBridgedObjectInterface { + DoorkeeperBridgedObjectInterface, + PhabricatorEditEngineSubtypeInterface { const MARKUP_FIELD_DESCRIPTION = 'markup:desc'; @@ -40,6 +41,7 @@ final class ManiphestTask extends ManiphestDAO protected $bridgedObjectPHID; protected $properties = array(); protected $points; + protected $subtype; private $subscriberPHIDs = self::ATTACHABLE; private $groupByProjectPHID = self::ATTACHABLE; @@ -63,6 +65,7 @@ final class ManiphestTask extends ManiphestDAO ->setViewPolicy($view_policy) ->setEditPolicy($edit_policy) ->setSpacePHID($actor->getDefaultSpacePHID()) + ->setSubtype(PhabricatorEditEngineSubtype::SUBTYPE_DEFAULT) ->attachProjectPHIDs(array()) ->attachSubscriberPHIDs(array()); } @@ -86,6 +89,7 @@ final class ManiphestTask extends ManiphestDAO 'subpriority' => 'double', 'points' => 'double?', 'bridgedObjectPHID' => 'phid?', + 'subtype' => 'text64', ), self::CONFIG_KEY_SCHEMA => array( 'key_phid' => null, @@ -124,6 +128,9 @@ final class ManiphestTask extends ManiphestDAO 'columns' => array('bridgedObjectPHID'), 'unique' => true, ), + 'key_subtype' => array( + 'columns' => array('subtype'), + ), ), ) + parent::getConfiguration(); } @@ -474,6 +481,10 @@ final class ManiphestTask extends ManiphestDAO ->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 @@ final class ManiphestTask extends ManiphestDAO 'status' => $status_info, 'priority' => $priority_info, 'points' => $this->getPoints(), + 'subtype' => $this->getSubtype(), ); } @@ -533,4 +545,16 @@ final class ManiphestTask extends ManiphestDAO 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 index 0000000000..9c15232b7e --- /dev/null +++ b/src/applications/transactions/editengine/PhabricatorEditEngineSubtypeInterface.php @@ -0,0 +1,8 @@ +