Skip to content
Snippets Groups Projects
Unverified Commit 7fa0d182 authored by metamben's avatar metamben Committed by GitHub
Browse files

Report the ID of the app (not the coll) under [:collection :app_id] (#25237)

Fixes #25213.
parent 9c3b6b9b
Branches
Tags
No related merge requests found
......@@ -132,7 +132,7 @@
(defmethod columns-for-model "card"
[_]
(conj default-columns :collection_id :collection_position :dataset_query
[:collection_app.collection_id :collection_app_id]
[:collection_app.id :collection_app_id]
[:collection.name :collection_name]
[:collection.authority_level :collection_authority_level]
[{:select [:status]
......@@ -151,7 +151,7 @@
(defmethod columns-for-model "dashboard"
[_]
(conj default-columns :collection_id :collection_position bookmark-col
[:collection_app.collection_id :collection_app_id]
[:collection_app.id :collection_app_id]
[:collection.name :collection_name]
[:collection.authority_level :collection_authority_level]))
......@@ -162,7 +162,7 @@
(defmethod columns-for-model "pulse"
[_]
[:id :name :collection_id
[:collection_app.collection_id :collection_app_id]
[:collection_app.id :collection_app_id]
[:collection.name :collection_name]])
(defmethod columns-for-model "collection"
......
......@@ -640,3 +640,28 @@
(is (partial= [(assoc (select-keys page [:name :description])
:model "page")]
(search-request-data :rasta :q "important text" :models "page"))))))
(deftest collection-app-id-test
(testing "app_id and id of containing collection should not be confused (#25213)"
(mt/with-temp* [Collection [{coll-id :id}]
;; The ignored elements are there to make sure the IDs
;; coll-id and app-id are different.
Collection [{ignored-collection-id :id}]
App [_ignored-app {:collection_id ignored-collection-id}]
App [{app-id :id} {:collection_id coll-id}]
Dashboard [_ {:name "Not a page but contains important text!"
:collection_id coll-id}]
Dashboard [_ {:name "Page"
:description "Contains important text!"
:collection_id coll-id
:is_app_page true}]
Card [_ {:name "Query looking for important text"
:query_type "native"
:dataset_query (mt/native-query {:query "SELECT 0 FROM venues"})
:collection_id coll-id}]
Pulse [_ {:name "Pulse about important text"
:collection_id coll-id}]]
(is (not= app-id coll-id) "app-id and coll-id should be different. Fix the test!")
(is (partial= (repeat 4 {:collection {:app_id app-id
:id coll-id}})
(:data (make-search-request :rasta [:q "important text"])))))))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment