diff --git a/src/Events/ScriptsSaved.php b/src/Events/ScriptsSaved.php new file mode 100644 index 0000000..83bca68 --- /dev/null +++ b/src/Events/ScriptsSaved.php @@ -0,0 +1,14 @@ + cp_route('cookie-notice.scripts.edit'), ]); }); + + if (Statamic::pro() && config('statamic.git.enabled')) { + Event::listen(ScriptsSaved::class, fn ($event) => (new Statamic\Git\Subscriber)->commit($event)); + } } } diff --git a/tests/Scripts/ScriptsTest.php b/tests/Scripts/ScriptsTest.php index 91f5cd9..78d5a4e 100644 --- a/tests/Scripts/ScriptsTest.php +++ b/tests/Scripts/ScriptsTest.php @@ -1,6 +1,8 @@ with(['necessary' => [ [ @@ -120,4 +124,6 @@ 'gtm_container_id' => 'GTM-123456CN', ], ]]); + + Event::assertDispatched(ScriptsSaved::class); });