diff --git a/src/applications/herald/action/HeraldAction.php b/src/applications/herald/action/HeraldAction.php --- a/src/applications/herald/action/HeraldAction.php +++ b/src/applications/herald/action/HeraldAction.php @@ -101,7 +101,9 @@ return array(); } - return $datasource->getWireTokens($target); + return $datasource + ->setViewer($viewer) + ->getWireTokens($target); } return $target; @@ -348,10 +350,14 @@ return pht( 'This action specifies no targets.'); case self::DO_STANDARD_NO_EFFECT: - return pht( - 'This action has no effect on %s target(s): %s.', - phutil_count($data), - $this->renderHandleList($data)); + if ($data && is_array($data)) { + return pht( + 'This action has no effect on %s target(s): %s.', + phutil_count($data), + $this->renderHandleList($data)); + } else { + return pht('This action has no effect.'); + } case self::DO_STANDARD_INVALID: return pht( '%s target(s) are invalid or of the wrong type: %s.', diff --git a/src/applications/maniphest/herald/ManiphestTaskAssignHeraldAction.php b/src/applications/maniphest/herald/ManiphestTaskAssignHeraldAction.php --- a/src/applications/maniphest/herald/ManiphestTaskAssignHeraldAction.php +++ b/src/applications/maniphest/herald/ManiphestTaskAssignHeraldAction.php @@ -23,12 +23,21 @@ PhabricatorPeopleUserPHIDType::TYPECONST, ); - $targets = $this->loadStandardTargets($phids, $allowed_types, $current); - if (!$targets) { - return; - } + if (head($phids) == PhabricatorPeopleNoOwnerDatasource::FUNCTION_TOKEN) { + $phid = null; + + if ($object->getOwnerPHID() == null) { + $this->logEffect(self::DO_STANDARD_NO_EFFECT); + return; + } + } else { + $targets = $this->loadStandardTargets($phids, $allowed_types, $current); + if (!$targets) { + return; + } - $phid = head_key($targets); + $phid = head_key($targets); + } $xaction = $adapter->newTransaction() ->setTransactionType(ManiphestTransaction::TYPE_OWNER) @@ -52,9 +61,13 @@ protected function renderActionEffectDescription($type, $data) { switch ($type) { case self::DO_ASSIGN: - return pht( - 'Assigned task to: %s.', - $this->renderHandleList($data)); + if (head($data) === null) { + return pht('Unassigned task.'); + } else { + return pht( + 'Assigned task to: %s.', + $this->renderHandleList($data)); + } } } diff --git a/src/applications/maniphest/herald/ManiphestTaskAssignOtherHeraldAction.php b/src/applications/maniphest/herald/ManiphestTaskAssignOtherHeraldAction.php --- a/src/applications/maniphest/herald/ManiphestTaskAssignOtherHeraldAction.php +++ b/src/applications/maniphest/herald/ManiphestTaskAssignOtherHeraldAction.php @@ -24,11 +24,15 @@ protected function getDatasource() { // TODO: Eventually, it would be nice to get "limit = 1" exported from here // up to the UI. - return new PhabricatorPeopleDatasource(); + return new ManiphestAssigneeDatasource(); } public function renderActionDescription($value) { - return pht('Assign task to: %s.', $this->renderHandleList($value)); + if (head($value) === PhabricatorPeopleNoOwnerDatasource::FUNCTION_TOKEN) { + return pht('Unassign task.'); + } else { + return pht('Assign task to: %s.', $this->renderHandleList($value)); + } } }