diff options
author | Bharat Mediratta <bharat@menalto.com> | 2009-01-25 07:58:58 +0000 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2009-01-25 07:58:58 +0000 |
commit | 1633001d7fddbb5fd5baa0a774041e001d8e7723 (patch) | |
tree | 5b10a96b167e210dc1ba58944ed8819601d203ee /core | |
parent | ffa1fa45f691160aa369e772b71618a547742625 (diff) |
Update the album cover if necessary.
Diffstat (limited to 'core')
-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}"))); |