1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-20 20:40:56 +01:00

Fix bad query edge condition when updating a revision with no attached tasks.

This commit is contained in:
epriestley 2011-12-04 13:03:12 -08:00
parent 588b959c03
commit 2797903776
2 changed files with 15 additions and 4 deletions

View file

@ -69,10 +69,13 @@ final class DifferentialManiphestTasksFieldSpecification
$user = $this->getUser();
$type = ManiphestTransactionType::TYPE_ATTACH;
$attach_type = PhabricatorPHIDConstants::PHID_TYPE_DREV;
$attach_data = array($revision->getPHID() => array());
$tasks = id(new ManiphestTask())
->loadAllWhere('phid IN (%Ld)', $this->maniphestTasks);
$tasks = array();
if ($this->maniphestTasks) {
$tasks = id(new ManiphestTask())->loadAllWhere(
'phid IN (%Ls)',
$this->maniphestTasks);
}
foreach ($tasks as $task) {
$transaction = new ManiphestTransaction();
@ -80,7 +83,10 @@ final class DifferentialManiphestTasksFieldSpecification
$transaction->setTransactionType($type);
$new = $task->getAttached();
$new[$attach_type] = $attach_data;
if (empty($new[$attach_type])) {
$new[$attach_type] = array();
}
$new[$attach_type][$revision->getPHID] = array();
$transaction->setNewValue($new);
$maniphest_editor->applyTransactions($task, array($transaction));

View file

@ -283,6 +283,11 @@ function _qsprintf_check_scalar_type($value, $type, $query) {
$query,
"Expected a scalar or null for %{$type} conversion.");
}
if (!is_numeric($value)) {
throw new AphrontQueryParameterException(
$query,
"Expected numeric value for %{$type} conversion.");
}
break;
case 'Ls': case 's':