diff --git a/app/Jobs/CloneImagesOrVideos.php b/app/Jobs/CloneImagesOrVideos.php index f087975d4..4f337e11a 100644 --- a/app/Jobs/CloneImagesOrVideos.php +++ b/app/Jobs/CloneImagesOrVideos.php @@ -144,10 +144,10 @@ public function handle() if ($volume->hasIfdo()) { $this->copyIfdoFile($volume->id, $copy->id); } - $copy->save(); - $copy->creating_async = false; + $copy->save(); + event('volume.cloned', [$copy->id]); }); diff --git a/tests/php/Jobs/CloneImagesOrVideosTest.php b/tests/php/Jobs/CloneImagesOrVideosTest.php index 8da61a120..f53016c06 100644 --- a/tests/php/Jobs/CloneImagesOrVideosTest.php +++ b/tests/php/Jobs/CloneImagesOrVideosTest.php @@ -32,6 +32,9 @@ public function testCloneImageVolume() $volume = $this->volume([ 'created_at' => '2022-11-09 14:37:00', 'updated_at' => '2022-11-09 14:37:00', + 'attrs' => [ + 'creating_async' => true, + ], ])->fresh(); // Use fresh() to load even the null fields. $copy = $volume->replicate(); @@ -63,6 +66,7 @@ public function testCloneImageVolume() $this->assertNotEquals($volume->created_at, $copy->created_at); $this->assertNotEquals($volume->updated_at, $copy->updated_at); $this->assertEmpty($copy->images()->first()->labels()->get()); + $this->assertFalse($copy->creating_async); $ignore = ['id', 'created_at', 'updated_at']; $this->assertEquals( @@ -78,6 +82,9 @@ public function testCloneVideoVolume() 'created_at' => '2022-01-09 14:37:00', 'updated_at' => '2022-01-09 14:37:00', 'media_type_id' => MediaType::videoId(), + 'attrs' => [ + 'creating_async' => true, + ], ])->fresh(); // Use fresh() to load even the null fields. $copy = $volume->replicate(); $copy->save(); @@ -104,6 +111,7 @@ public function testCloneVideoVolume() $copy = $project->volumes()->first(); $this->assertEmpty($copy->videos()->first()->labels()->get()); + $this->assertFalse($copy->creating_async); } public function testCloneVolumeImages()