diff --git a/src/metabase/api/collection.clj b/src/metabase/api/collection.clj index 3a6590f5d97391fa81bfea9976f73df8d20eddbe..91a30a969026b73e6b2240e785f9f6b9dd9f2bd5 100644 --- a/src/metabase/api/collection.clj +++ b/src/metabase/api/collection.clj @@ -635,6 +635,7 @@ `post-process-collection-children`. Must respect the order passed in." [collection rows] (->> (map-indexed (fn [i row] (vary-meta row assoc ::index i)) rows) ;; keep db sort order + (map #(assoc % :collection_id (:id collection))) (map remove-unwanted-keys) (group-by :model) (into [] diff --git a/test/metabase/api/collection_test.clj b/test/metabase/api/collection_test.clj index 918516a92cfc602a1e37351ef0f4ed346664be10..8aead3eec884bdbd5e5eaa81f0f97e957daeae27 100644 --- a/test/metabase/api/collection_test.clj +++ b/test/metabase/api/collection_test.clj @@ -647,7 +647,8 @@ :moderator_id user-id :most_recent true}] (is (= (mt/obj->json->obj - [{:id card-id + [{:collection_id (:id collection) + :id card-id :location nil :name (:name card) :collection_position nil