Skip to content
Open
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
10 changes: 8 additions & 2 deletions api/components/com_joomlaupdate/src/View/Updates/JsonapiView.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,13 +136,19 @@ public function finalizeUpdate($fromVersion, $updateFileName)
$model->resetUpdateSource();

$success = true;
$errors = [];

// Append any errors to the API response for debugging purposes
if ($model->getErrors()) {
$success = false;

$errors = array_map(function ($error) {
return (string) $error;
}, $model->getErrors());
}

$element = (new Resource((object) ['success' => $success, 'id' => 'finalizeUpdate'], $this->serializer))
->fields(['updates' => ['success']]);
$element = (new Resource((object) ['success' => $success, 'id' => 'finalizeUpdate', 'errors' => $errors], $this->serializer))
->fields(['updates' => ['success', 'errors']]);

$this->getDocument()->setData($element);
$this->getDocument()->addLink('self', Uri::current());
Expand Down
Loading