Skip to content

Commit

Permalink
Ignore locks on API requests
Browse files Browse the repository at this point in the history
  • Loading branch information
Sylvester Damgaard committed May 16, 2024
1 parent 411afca commit 9c9551d
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/Listeners/LockListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Statamic\Events;
use Statamic\Facades\Site;
use Statamic\Facades\User;
use Statamic\Support\Str;
use Tv2regionerne\StatamicLocks\Models\LockModel;

class LockListener
Expand All @@ -16,6 +17,14 @@ public function handle($event)
$itemId = false;
$itemType = false;

$path = request()->path();

// ignore locks on API requests
if (Str::of($path)->startsWith('api')) {
return;
}


if ($event instanceof Events\AssetSaving) {
$itemId = $event->asset->id() ?? false;
$itemType = 'asset';
Expand Down

0 comments on commit 9c9551d

Please sign in to comment.