diff --git a/resources/sql/autopatches/20150609.spaces.2.maniphest.sql b/resources/sql/autopatches/20150609.spaces.2.maniphest.sql new file mode 100644 index 0000000000..d46b5e5908 --- /dev/null +++ b/resources/sql/autopatches/20150609.spaces.2.maniphest.sql @@ -0,0 +1,2 @@ +ALTER TABLE {$NAMESPACE}_maniphest.maniphest_task + ADD spacePHID VARBINARY(64); diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index eaa7e4fa04..c389400972 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -4405,6 +4405,7 @@ phutil_register_library_map(array( 'PhabricatorDestructibleInterface', 'PhabricatorApplicationTransactionInterface', 'PhabricatorProjectInterface', + 'PhabricatorSpacesInterface', ), 'ManiphestTaskClosedStatusDatasource' => 'PhabricatorTypeaheadDatasource', 'ManiphestTaskDependedOnByTaskEdgeType' => 'PhabricatorEdgeType', diff --git a/src/applications/maniphest/controller/ManiphestTaskEditController.php b/src/applications/maniphest/controller/ManiphestTaskEditController.php index d9a4e44381..72b75c876f 100644 --- a/src/applications/maniphest/controller/ManiphestTaskEditController.php +++ b/src/applications/maniphest/controller/ManiphestTaskEditController.php @@ -155,12 +155,15 @@ final class ManiphestTaskEditController extends ManiphestController { $aux_fields = $field_list->getFields(); + $v_space = $task->getSpacePHID(); + if ($request->isFormPost()) { $changes = array(); $new_title = $request->getStr('title'); $new_desc = $request->getStr('description'); $new_status = $request->getStr('status'); + $v_space = $request->getStr('spacePHID'); if (!$task->getID()) { $workflow = 'create'; @@ -268,6 +271,7 @@ final class ManiphestTaskEditController extends ManiphestController { } if ($can_edit_policies) { + $changes[PhabricatorTransactions::TYPE_SPACE] = $v_space; $changes[PhabricatorTransactions::TYPE_VIEW_POLICY] = $request->getStr('viewPolicy'); $changes[PhabricatorTransactions::TYPE_EDIT_POLICY] = @@ -477,6 +481,8 @@ final class ManiphestTaskEditController extends ManiphestController { $task->setViewPolicy($template_task->getViewPolicy()); $task->setEditPolicy($template_task->getEditPolicy()); + $v_space = $template_task->getSpacePHID(); + $template_fields = PhabricatorCustomField::getObjectFields( $template_task, PhabricatorCustomField::ROLE_EDIT); @@ -643,6 +649,7 @@ final class ManiphestTaskEditController extends ManiphestController { ->setCapability(PhabricatorPolicyCapability::CAN_VIEW) ->setPolicyObject($task) ->setPolicies($policies) + ->setSpacePHID($v_space) ->setName('viewPolicy')) ->appendChild( id(new AphrontFormPolicyControl()) diff --git a/src/applications/maniphest/storage/ManiphestTask.php b/src/applications/maniphest/storage/ManiphestTask.php index cdf4b4a575..f244a1c918 100644 --- a/src/applications/maniphest/storage/ManiphestTask.php +++ b/src/applications/maniphest/storage/ManiphestTask.php @@ -12,7 +12,8 @@ final class ManiphestTask extends ManiphestDAO PhabricatorCustomFieldInterface, PhabricatorDestructibleInterface, PhabricatorApplicationTransactionInterface, - PhabricatorProjectInterface { + PhabricatorProjectInterface, + PhabricatorSpacesInterface { const MARKUP_FIELD_DESCRIPTION = 'markup:desc'; @@ -35,6 +36,7 @@ final class ManiphestTask extends ManiphestDAO protected $projectPHIDs = array(); protected $ownerOrdering; + protected $spacePHID; private $subscriberPHIDs = self::ATTACHABLE; private $groupByProjectPHID = self::ATTACHABLE; @@ -379,4 +381,12 @@ final class ManiphestTask extends ManiphestDAO return $timeline; } + +/* -( PhabricatorSpacesInterface )----------------------------------------- */ + + + public function getSpacePHID() { + return $this->spacePHID; + } + } diff --git a/src/applications/maniphest/view/ManiphestTaskListView.php b/src/applications/maniphest/view/ManiphestTaskListView.php index 0dca204391..05adced87a 100644 --- a/src/applications/maniphest/view/ManiphestTaskListView.php +++ b/src/applications/maniphest/view/ManiphestTaskListView.php @@ -57,10 +57,12 @@ final class ManiphestTaskListView extends ManiphestView { } foreach ($this->tasks as $task) { - $item = new PHUIObjectItemView(); - $item->setObjectName('T'.$task->getID()); - $item->setHeader($task->getTitle()); - $item->setHref('/T'.$task->getID()); + $item = id(new PHUIObjectItemView()) + ->setUser($this->getUser()) + ->setObject($task) + ->setObjectName('T'.$task->getID()) + ->setHeader($task->getTitle()) + ->setHref('/T'.$task->getID()); if ($task->getOwnerPHID()) { $owner = $handles[$task->getOwnerPHID()]; diff --git a/src/applications/project/view/ProjectBoardTaskCard.php b/src/applications/project/view/ProjectBoardTaskCard.php index a601608ebf..0f4f14694c 100644 --- a/src/applications/project/view/ProjectBoardTaskCard.php +++ b/src/applications/project/view/ProjectBoardTaskCard.php @@ -49,6 +49,8 @@ final class ProjectBoardTaskCard { $bar_color = idx($color_map, $task->getPriority(), 'grey'); $card = id(new PHUIObjectItemView()) + ->setObject($task) + ->setUser($this->getViewer()) ->setObjectName('T'.$task->getID()) ->setHeader($task->getTitle()) ->setGrippable($can_edit)