mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-19 03:50:54 +01:00
Fix bad query edge condition when updating a revision with no attached tasks.
This commit is contained in:
parent
588b959c03
commit
2797903776
2 changed files with 15 additions and 4 deletions
|
@ -69,10 +69,13 @@ final class DifferentialManiphestTasksFieldSpecification
|
||||||
$user = $this->getUser();
|
$user = $this->getUser();
|
||||||
$type = ManiphestTransactionType::TYPE_ATTACH;
|
$type = ManiphestTransactionType::TYPE_ATTACH;
|
||||||
$attach_type = PhabricatorPHIDConstants::PHID_TYPE_DREV;
|
$attach_type = PhabricatorPHIDConstants::PHID_TYPE_DREV;
|
||||||
$attach_data = array($revision->getPHID() => array());
|
|
||||||
|
|
||||||
$tasks = id(new ManiphestTask())
|
$tasks = array();
|
||||||
->loadAllWhere('phid IN (%Ld)', $this->maniphestTasks);
|
if ($this->maniphestTasks) {
|
||||||
|
$tasks = id(new ManiphestTask())->loadAllWhere(
|
||||||
|
'phid IN (%Ls)',
|
||||||
|
$this->maniphestTasks);
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($tasks as $task) {
|
foreach ($tasks as $task) {
|
||||||
$transaction = new ManiphestTransaction();
|
$transaction = new ManiphestTransaction();
|
||||||
|
@ -80,7 +83,10 @@ final class DifferentialManiphestTasksFieldSpecification
|
||||||
$transaction->setTransactionType($type);
|
$transaction->setTransactionType($type);
|
||||||
|
|
||||||
$new = $task->getAttached();
|
$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);
|
$transaction->setNewValue($new);
|
||||||
$maniphest_editor->applyTransactions($task, array($transaction));
|
$maniphest_editor->applyTransactions($task, array($transaction));
|
||||||
|
|
|
@ -283,6 +283,11 @@ function _qsprintf_check_scalar_type($value, $type, $query) {
|
||||||
$query,
|
$query,
|
||||||
"Expected a scalar or null for %{$type} conversion.");
|
"Expected a scalar or null for %{$type} conversion.");
|
||||||
}
|
}
|
||||||
|
if (!is_numeric($value)) {
|
||||||
|
throw new AphrontQueryParameterException(
|
||||||
|
$query,
|
||||||
|
"Expected numeric value for %{$type} conversion.");
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'Ls': case 's':
|
case 'Ls': case 's':
|
||||||
|
|
Loading…
Reference in a new issue