diff --git a/src/applications/maniphest/typeahead/ManiphestAssigneeDatasource.php b/src/applications/maniphest/typeahead/ManiphestAssigneeDatasource.php --- a/src/applications/maniphest/typeahead/ManiphestAssigneeDatasource.php +++ b/src/applications/maniphest/typeahead/ManiphestAssigneeDatasource.php @@ -13,6 +13,7 @@ public function getComponentDatasources() { return array( + new PhabricatorViewerDatasource(), new PhabricatorPeopleDatasource(), new PhabricatorPeopleNoOwnerDatasource(), ); diff --git a/src/applications/people/typeahead/PhabricatorViewerDatasource.php b/src/applications/people/typeahead/PhabricatorViewerDatasource.php --- a/src/applications/people/typeahead/PhabricatorViewerDatasource.php +++ b/src/applications/people/typeahead/PhabricatorViewerDatasource.php @@ -3,6 +3,8 @@ final class PhabricatorViewerDatasource extends PhabricatorTypeaheadDatasource { + const FUNCTION_TOKEN = 'viewer()'; + public function getBrowseTitle() { return pht('Browse Viewer'); } diff --git a/src/applications/project/trigger/PhabricatorProjectTriggerManiphestOwnerRule.php b/src/applications/project/trigger/PhabricatorProjectTriggerManiphestOwnerRule.php --- a/src/applications/project/trigger/PhabricatorProjectTriggerManiphestOwnerRule.php +++ b/src/applications/project/trigger/PhabricatorProjectTriggerManiphestOwnerRule.php @@ -18,6 +18,9 @@ if ($value === PhabricatorPeopleNoOwnerDatasource::FUNCTION_TOKEN) { $value = null; } + if ($value === PhabricatorViewerDatasource::FUNCTION_TOKEN) { + $value = $this->getViewer()->getPHID(); + } return $value; } @@ -35,7 +38,8 @@ throw new Exception( pht( 'Owner rule value is required. Specify a user to assign tasks '. - 'to, or the token "none()" to unassign tasks.')); + 'to, the token "viewer()" to assign to the user moving tasks, '. + 'or the token "none()" to unassign tasks.')); } if (count($value) > 1) { @@ -123,11 +127,10 @@ } public function getRuleViewDescription($value) { - $value = $this->convertTokenizerValueToOwner($value); - - if (!$value) { - return pht('Unassign task.'); - } else { + if (head($value) === PhabricatorViewerDatasource::FUNCTION_TOKEN) { + return pht('Assign task to user moving the task.'); + } else if ($value) { + $value = $this->convertTokenizerValueToOwner($value); return pht( 'Assign task to %s.', phutil_tag( @@ -136,6 +139,8 @@ $this->getViewer() ->renderHandle($value) ->render())); + } else { // !$value + return pht('Unassign task.'); } }