Differential D20417 Diff 48761 src/applications/project/trigger/PhabricatorProjectTriggerManiphestOwnerRule.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/project/trigger/PhabricatorProjectTriggerManiphestOwnerRule.php
Show All 15 Lines | final class PhabricatorProjectTriggerManiphestOwnerRule | ||||
private function convertTokenizerValueToOwner($value) { | private function convertTokenizerValueToOwner($value) { | ||||
$value = head($value); | $value = head($value); | ||||
if ($value === PhabricatorPeopleNoOwnerDatasource::FUNCTION_TOKEN) { | if ($value === PhabricatorPeopleNoOwnerDatasource::FUNCTION_TOKEN) { | ||||
$value = null; | $value = null; | ||||
} | } | ||||
return $value; | return $value; | ||||
} | } | ||||
protected function assertValidRuleValue($value) { | protected function assertValidRuleRecordFormat($value) { | ||||
if (!is_array($value)) { | if (!is_array($value)) { | ||||
throw new Exception( | throw new Exception( | ||||
pht( | pht( | ||||
'Owner rule value should be a list, but is not (value is "%s").', | 'Owner rule value should be a list, but is not (value is "%s").', | ||||
phutil_describe_type($value))); | phutil_describe_type($value))); | ||||
} | } | ||||
} | |||||
protected function assertValidRuleRecordValue($value) { | |||||
if (!$value) { | |||||
throw new Exception( | |||||
pht( | |||||
'Owner rule value is required. Specify a user to assign tasks '. | |||||
'to, or the token "none()" to unassign tasks.')); | |||||
amckinley: Searching for `"none()"` in the tokenizer doesn't give you any results, FWIW. You have to… | |||||
Done Inline Actionsepriestley: Hmm, it does for me?
{F6382796}
I //think// either "none()" or "null" work via Conduit. | |||||
Not Done Inline ActionsHuh, no longer reproduces for me. I definitely had to backspace twice to change "none" to "no" to get the tokenizer to work before, but it's fine now. amckinley: Huh, no longer reproduces for me. I definitely had to backspace twice to change "none" to "no"… | |||||
} | |||||
if (count($value) != 1) { | if (count($value) > 1) { | ||||
throw new Exception( | throw new Exception( | ||||
pht( | pht( | ||||
'Owner rule value should be a list of exactly one user PHID, or the '. | 'Owner rule value must have only one elmement (value is "%s").', | ||||
'token "none()" (value is "%s").', | |||||
implode(', ', $value))); | implode(', ', $value))); | ||||
} | } | ||||
$owner_phid = $this->convertTokenizerValueToOwner($value); | |||||
if ($owner_phid !== null) { | |||||
$user = id(new PhabricatorPeopleQuery()) | |||||
->setViewer($this->getViewer()) | |||||
Not Done Inline ActionsI am pretty sure that we've always called setViewer() by now, but I'm not positive. If it worked when you tried to hit this error, that works for me. amckinley: I am //pretty sure// that we've always called `setViewer()` by now, but I'm not positive. If it… | |||||
->withPHIDs(array($owner_phid)) | |||||
->executeOne(); | |||||
if (!$user) { | |||||
throw new Exception( | |||||
pht( | |||||
'User PHID ("%s") is not a valid user.', | |||||
$owner_phid)); | |||||
} | |||||
} | |||||
} | } | ||||
protected function newDropTransactions($object, $value) { | protected function newDropTransactions($object, $value) { | ||||
$value = $this->convertTokenizerValueToOwner($value); | $value = $this->convertTokenizerValueToOwner($value); | ||||
return array( | return array( | ||||
$this->newTransaction() | $this->newTransaction() | ||||
->setTransactionType(ManiphestTaskOwnerTransaction::TRANSACTIONTYPE) | ->setTransactionType(ManiphestTaskOwnerTransaction::TRANSACTIONTYPE) | ||||
->setNewValue($value), | ->setNewValue($value), | ||||
▲ Show 20 Lines • Show All 80 Lines • Show Last 20 Lines |
Searching for "none()" in the tokenizer doesn't give you any results, FWIW. You have to search for "No Owner". I guess this error is only likely to ever be returned to hypothetical Conduit callers who would be passing the literal string "none()" around, though. (Or should they be passing null?)