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,7 +127,13 @@ } public function getRuleViewDescription($value) { - $value = $this->convertTokenizerValueToOwner($value); + if (head($value) === PhabricatorViewerDatasource::FUNCTION_TOKEN) { + // TODO: String concatenation breaks 18n because of grammatical case; + // full string is "Assign task to user moving the task". + $value = 'user moving the task'; + } else { + $value = $this->convertTokenizerValueToOwner($value); + } if (!$value) { return pht('Unassign task.');