diff options
-rw-r--r-- | core/controllers/move.php | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/core/controllers/move.php b/core/controllers/move.php index 2171d492..26c507f9 100644 --- a/core/controllers/move.php +++ b/core/controllers/move.php @@ -35,6 +35,15 @@ class Move_Controller extends Controller { $target = ORM::factory("item", $this->input->post("target_id")); access::required("edit", $target); $source->move_to($target); + + // If the target has no cover item, make this it. + if ($target->album_cover_item_id == null) { + $target->album_cover_item_id = + $source->type == "album" ? $source->album_cover_item_id : $source->id; + $target->save(); + graphics::generate($target); + } + print json_encode( array("result" => "success", "location" => url::site("albums/{$target->id}"))); |