From f558bc880a1767da982b30c8d0f29b937fd9aa0e Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Sat, 30 Jan 2021 18:07:48 -0800 Subject: [PATCH] Correctly handle error; don't overwrite laravel method --- app/Models/AuditLog.php | 2 +- app/Models/Server.php | 2 +- .../scripts/components/server/backups/BackupContextMenu.tsx | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/Models/AuditLog.php b/app/Models/AuditLog.php index 57b61e1b7..c56eae4a8 100644 --- a/app/Models/AuditLog.php +++ b/app/Models/AuditLog.php @@ -101,7 +101,7 @@ class AuditLog extends Model * * @return $this */ - public static function factory(string $action, array $metadata, bool $isSystem = false) + public static function instance(string $action, array $metadata, bool $isSystem = false) { /** @var \Illuminate\Http\Request $request */ $request = Container::getInstance()->make('request'); diff --git a/app/Models/Server.php b/app/Models/Server.php index 9aa4b618d..bd539282a 100644 --- a/app/Models/Server.php +++ b/app/Models/Server.php @@ -336,7 +336,7 @@ class Server extends Model */ public function newAuditEvent(string $action, array $metadata = []): AuditLog { - return AuditLog::factory($action, $metadata)->fill([ + return AuditLog::instance($action, $metadata)->fill([ 'server_id' => $this->id, ]); } diff --git a/resources/scripts/components/server/backups/BackupContextMenu.tsx b/resources/scripts/components/server/backups/BackupContextMenu.tsx index 33cd327b7..bef067319 100644 --- a/resources/scripts/components/server/backups/BackupContextMenu.tsx +++ b/resources/scripts/components/server/backups/BackupContextMenu.tsx @@ -71,7 +71,8 @@ export default ({ backup }: Props) => { console.error(error); clearAndAddHttpError({ key: 'backups', error }); }) - .then(() => setLoading(false)); + .then(() => setLoading(false)) + .then(() => setModal('')); }; return (