Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/inc/apiv2/model/taskwrappers.routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,13 @@ protected function deleteObject(object $object): void {
$joined = Factory::getTaskFactory()->filter([Factory::FILTER => $qF, Factory::JOIN => $jF]);
$task = $joined[Factory::getTaskFactory()->getModelName()][0];
// api=true to avoid TaskUtils::delete setting 'Location:' header
TaskUtils::delete($task->getId(), $this->getCurrentUser(), true);
if ($task !== null) {
TaskUtils::delete($task->getId(), $this->getCurrentUser(), true);
} else {
// This should not happen because every taskwrapper should have a task
// but since there are no database constraints this cant be enforced.
Factory::getTaskWrapperFactory()->delete($object);
}
break;
case DTaskTypes::SUPERTASK:
TaskUtils::deleteSupertask($object->getId(), $this->getCurrentUser());
Expand Down
4 changes: 4 additions & 0 deletions src/inc/utils/TaskwrapperUtils.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
use DBA\Task;
use DBA\QueryFilter;
use DBA\JoinFilter;
require_once __DIR__ . '/../apiv2/common/ErrorHandler.class.php';

class TaskwrapperUtils {

Expand Down Expand Up @@ -31,6 +32,9 @@ public static function updatePriority($taskWrapperId, $priority, $user) {
$jF = new JoinFilter(Factory::getTaskWrapperFactory(), Task::TASK_WRAPPER_ID, TaskWrapper::TASK_WRAPPER_ID);
$joined = Factory::getTaskFactory()->filter([Factory::FILTER => $qF, Factory::JOIN => $jF]);
$task = $joined[Factory::getTaskFactory()->getModelName()][0];
if ($task === null) {
throw new HttpError("Invallid task, Taskwrapper does not have a task");
Copy link

Copilot AI Sep 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a spelling error in the error message. 'Invallid' should be 'Invalid'.

Suggested change
throw new HttpError("Invallid task, Taskwrapper does not have a task");
throw new HttpError("Invalid task, Taskwrapper does not have a task");

Copilot uses AI. Check for mistakes.
}

TaskUtils::updatePriority($task->getId(), $priority, $user);
break;
Expand Down