summaryrefslogtreecommitdiff
path: root/modules/gallery/helpers
diff options
context:
space:
mode:
Diffstat (limited to 'modules/gallery/helpers')
-rw-r--r--modules/gallery/helpers/item_rest.php18
1 files changed, 8 insertions, 10 deletions
diff --git a/modules/gallery/helpers/item_rest.php b/modules/gallery/helpers/item_rest.php
index 763e586f..27542dea 100644
--- a/modules/gallery/helpers/item_rest.php
+++ b/modules/gallery/helpers/item_rest.php
@@ -99,7 +99,7 @@ class item_rest_Core {
if ($entity = $request->params->entity) {
// Only change fields from a whitelist.
foreach (array("album_cover", "captured", "description",
- "height", "mime_type", "name", "parent", "rand_key", "resize_dirty",
+ "height", "mime_type", "name", "rand_key", "resize_dirty",
"resize_height", "resize_width", "slug", "sort_column", "sort_order",
"thumb_dirty", "thumb_height", "thumb_width", "title", "view_count",
"width") as $key) {
@@ -112,23 +112,21 @@ class item_rest_Core {
}
break;
- case "parent":
- if (property_exists($entity, "parent")) {
- $parent = rest::resolve($entity->parent);
- access::required("edit", $parent);
- $item->parent_id = $parent->id;
- }
- break;
default:
if (property_exists($entity, $key)) {
$item->$key = $entity->$key;
}
}
}
+
+ $item->save();
+ if (property_exists($entity, "parent")) {
+ $parent = rest::resolve($entity->parent);
+ item::move($item, $parent);
+ }
}
- $item->save();
- if (isset($request->params->members)) {
+ if (isset($request->params->members) && $item->sort_column == "weight") {
$weight = 0;
foreach ($request->params->members as $url) {
$child = rest::resolve($url);