mirror of
https://github.com/MrUnknownDE/panel.git
synced 2026-04-19 06:43:45 +02:00
Pass the updated model through for updating node config, rather than old model, ref #1237
This commit is contained in:
@@ -13,7 +13,6 @@ use Pterodactyl\Models\Node;
|
||||
use GuzzleHttp\Exception\ConnectException;
|
||||
use GuzzleHttp\Exception\RequestException;
|
||||
use Illuminate\Database\ConnectionInterface;
|
||||
use Pterodactyl\Traits\Services\ReturnsUpdatedModels;
|
||||
use Pterodactyl\Contracts\Repository\NodeRepositoryInterface;
|
||||
use Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException;
|
||||
use Pterodactyl\Exceptions\Service\Node\ConfigurationNotPersistedException;
|
||||
@@ -21,8 +20,6 @@ use Pterodactyl\Contracts\Repository\Daemon\ConfigurationRepositoryInterface;
|
||||
|
||||
class NodeUpdateService
|
||||
{
|
||||
use ReturnsUpdatedModels;
|
||||
|
||||
/**
|
||||
* @var \Illuminate\Database\ConnectionInterface
|
||||
*/
|
||||
@@ -74,14 +71,10 @@ class NodeUpdateService
|
||||
}
|
||||
|
||||
$this->connection->beginTransaction();
|
||||
if ($this->getUpdatedModel()) {
|
||||
$response = $this->repository->update($node->id, $data);
|
||||
} else {
|
||||
$response = $this->repository->withoutFreshModel()->update($node->id, $data);
|
||||
}
|
||||
$updatedModel = $this->repository->update($node->id, $data);
|
||||
|
||||
try {
|
||||
$this->configRepository->setNode($node)->update();
|
||||
$this->configRepository->setNode($updatedModel)->update();
|
||||
$this->connection->commit();
|
||||
} catch (RequestException $exception) {
|
||||
// Failed to connect to the Daemon. Let's go ahead and save the configuration
|
||||
@@ -95,6 +88,6 @@ class NodeUpdateService
|
||||
throw new DaemonConnectionException($exception);
|
||||
}
|
||||
|
||||
return $response;
|
||||
return $updatedModel;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user