Add a trigger rule to reassign a task

Summary:
Ref T13269. Workboard triggers can now reassign tasks on column drop. Also sprinkles some `setViewer()` calls in places that needed them.

This mostly works, but a few issues:

* To set the owner to unassigned, you must explicitly put the "No Owner" token in the typeahead. Maybe this should just figure out you've put nothing in that field and set it for you?
* I'm pretty sure this was already broken, but if you change the rule type from a tokenizer to a different type, the default for the field doesn't populate correctly: {F6312227}

Also adds a new hook for trigger rules: `getValueForField($value)` which allows you to transform a value stored in the DB into a form suitable for setting on a form control.

Test Plan: Dragged tasks between columns and observed new owners as expected. Didn't try to get fancy to assign tasks to deleted users, users that the viewer can't see, bot users, etc etc. I'm relying on the underlying transaction to hopefully do the right thing.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

Maniphest Tasks: T13269

Differential Revision: https://secure.phabricator.com/D20329
This commit is contained in:
Austin McKinley
2019-04-04 16:30:42 -07:00
parent e45ccdd892
commit 7e1743a959
8 changed files with 170 additions and 9 deletions

View File

@@ -577,6 +577,11 @@ final class PhabricatorProjectBoardViewController
$panel->addHeaderAction($column_menu);
if ($column->canHaveTrigger()) {
$trigger = $column->getTrigger();
if ($trigger) {
$trigger->setViewer($viewer);
}
$trigger_menu = $this->buildTriggerMenu($column);
$panel->addHeaderAction($trigger_menu);
}

View File

@@ -25,6 +25,8 @@ final class PhabricatorProjectTriggerEditController
$trigger = PhabricatorProjectTrigger::initializeNewTrigger();
}
$trigger->setViewer($viewer);
$column_phid = $request->getStr('columnPHID');
if ($column_phid) {
$column = id(new PhabricatorProjectColumnQuery())
@@ -272,6 +274,10 @@ final class PhabricatorProjectTriggerEditController
$rule_list = array_values($rule_list);
$type_list = PhabricatorProjectTriggerRule::getAllTriggerRules();
foreach ($type_list as $rule) {
$rule->setViewer($this->getViewer());
}
$type_list = mpull($type_list, 'newTemplate');
$type_list = array_values($type_list);

View File

@@ -20,6 +20,7 @@ final class PhabricatorProjectTriggerViewController
if (!$trigger) {
return new Aphront404Response();
}
$trigger->setViewer($viewer);
$rules_view = $this->newRulesView($trigger);
$columns_view = $this->newColumnsView($trigger);