1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-26 00:32:42 +01:00

Support Spaces in Maniphest

Summary:
Ref T8493. Tricks:

  - "Create Similar Task" and "Create Subtask" should copy the parent's Space.
  - Normal list view + workboard card view.

Test Plan:
  - Created a task, edited space, etc.
  - Viewed tasks with different users.
  - Created a "Similar Task" (saw proper Space).
  - Created a subtask (saw proper Space).
  - Viewed workboard.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T8493

Differential Revision: https://secure.phabricator.com/D13232
This commit is contained in:
epriestley 2015-06-10 15:53:04 -07:00
parent de0e0d995b
commit d118800d37
6 changed files with 29 additions and 5 deletions

View file

@ -0,0 +1,2 @@
ALTER TABLE {$NAMESPACE}_maniphest.maniphest_task
ADD spacePHID VARBINARY(64);

View file

@ -4405,6 +4405,7 @@ phutil_register_library_map(array(
'PhabricatorDestructibleInterface', 'PhabricatorDestructibleInterface',
'PhabricatorApplicationTransactionInterface', 'PhabricatorApplicationTransactionInterface',
'PhabricatorProjectInterface', 'PhabricatorProjectInterface',
'PhabricatorSpacesInterface',
), ),
'ManiphestTaskClosedStatusDatasource' => 'PhabricatorTypeaheadDatasource', 'ManiphestTaskClosedStatusDatasource' => 'PhabricatorTypeaheadDatasource',
'ManiphestTaskDependedOnByTaskEdgeType' => 'PhabricatorEdgeType', 'ManiphestTaskDependedOnByTaskEdgeType' => 'PhabricatorEdgeType',

View file

@ -155,12 +155,15 @@ final class ManiphestTaskEditController extends ManiphestController {
$aux_fields = $field_list->getFields(); $aux_fields = $field_list->getFields();
$v_space = $task->getSpacePHID();
if ($request->isFormPost()) { if ($request->isFormPost()) {
$changes = array(); $changes = array();
$new_title = $request->getStr('title'); $new_title = $request->getStr('title');
$new_desc = $request->getStr('description'); $new_desc = $request->getStr('description');
$new_status = $request->getStr('status'); $new_status = $request->getStr('status');
$v_space = $request->getStr('spacePHID');
if (!$task->getID()) { if (!$task->getID()) {
$workflow = 'create'; $workflow = 'create';
@ -268,6 +271,7 @@ final class ManiphestTaskEditController extends ManiphestController {
} }
if ($can_edit_policies) { if ($can_edit_policies) {
$changes[PhabricatorTransactions::TYPE_SPACE] = $v_space;
$changes[PhabricatorTransactions::TYPE_VIEW_POLICY] = $changes[PhabricatorTransactions::TYPE_VIEW_POLICY] =
$request->getStr('viewPolicy'); $request->getStr('viewPolicy');
$changes[PhabricatorTransactions::TYPE_EDIT_POLICY] = $changes[PhabricatorTransactions::TYPE_EDIT_POLICY] =
@ -477,6 +481,8 @@ final class ManiphestTaskEditController extends ManiphestController {
$task->setViewPolicy($template_task->getViewPolicy()); $task->setViewPolicy($template_task->getViewPolicy());
$task->setEditPolicy($template_task->getEditPolicy()); $task->setEditPolicy($template_task->getEditPolicy());
$v_space = $template_task->getSpacePHID();
$template_fields = PhabricatorCustomField::getObjectFields( $template_fields = PhabricatorCustomField::getObjectFields(
$template_task, $template_task,
PhabricatorCustomField::ROLE_EDIT); PhabricatorCustomField::ROLE_EDIT);
@ -643,6 +649,7 @@ final class ManiphestTaskEditController extends ManiphestController {
->setCapability(PhabricatorPolicyCapability::CAN_VIEW) ->setCapability(PhabricatorPolicyCapability::CAN_VIEW)
->setPolicyObject($task) ->setPolicyObject($task)
->setPolicies($policies) ->setPolicies($policies)
->setSpacePHID($v_space)
->setName('viewPolicy')) ->setName('viewPolicy'))
->appendChild( ->appendChild(
id(new AphrontFormPolicyControl()) id(new AphrontFormPolicyControl())

View file

@ -12,7 +12,8 @@ final class ManiphestTask extends ManiphestDAO
PhabricatorCustomFieldInterface, PhabricatorCustomFieldInterface,
PhabricatorDestructibleInterface, PhabricatorDestructibleInterface,
PhabricatorApplicationTransactionInterface, PhabricatorApplicationTransactionInterface,
PhabricatorProjectInterface { PhabricatorProjectInterface,
PhabricatorSpacesInterface {
const MARKUP_FIELD_DESCRIPTION = 'markup:desc'; const MARKUP_FIELD_DESCRIPTION = 'markup:desc';
@ -35,6 +36,7 @@ final class ManiphestTask extends ManiphestDAO
protected $projectPHIDs = array(); protected $projectPHIDs = array();
protected $ownerOrdering; protected $ownerOrdering;
protected $spacePHID;
private $subscriberPHIDs = self::ATTACHABLE; private $subscriberPHIDs = self::ATTACHABLE;
private $groupByProjectPHID = self::ATTACHABLE; private $groupByProjectPHID = self::ATTACHABLE;
@ -379,4 +381,12 @@ final class ManiphestTask extends ManiphestDAO
return $timeline; return $timeline;
} }
/* -( PhabricatorSpacesInterface )----------------------------------------- */
public function getSpacePHID() {
return $this->spacePHID;
}
} }

View file

@ -57,10 +57,12 @@ final class ManiphestTaskListView extends ManiphestView {
} }
foreach ($this->tasks as $task) { foreach ($this->tasks as $task) {
$item = new PHUIObjectItemView(); $item = id(new PHUIObjectItemView())
$item->setObjectName('T'.$task->getID()); ->setUser($this->getUser())
$item->setHeader($task->getTitle()); ->setObject($task)
$item->setHref('/T'.$task->getID()); ->setObjectName('T'.$task->getID())
->setHeader($task->getTitle())
->setHref('/T'.$task->getID());
if ($task->getOwnerPHID()) { if ($task->getOwnerPHID()) {
$owner = $handles[$task->getOwnerPHID()]; $owner = $handles[$task->getOwnerPHID()];

View file

@ -49,6 +49,8 @@ final class ProjectBoardTaskCard {
$bar_color = idx($color_map, $task->getPriority(), 'grey'); $bar_color = idx($color_map, $task->getPriority(), 'grey');
$card = id(new PHUIObjectItemView()) $card = id(new PHUIObjectItemView())
->setObject($task)
->setUser($this->getViewer())
->setObjectName('T'.$task->getID()) ->setObjectName('T'.$task->getID())
->setHeader($task->getTitle()) ->setHeader($task->getTitle())
->setGrippable($can_edit) ->setGrippable($can_edit)