Skip to content
Snippets Groups Projects
Commit cd526e4e authored by Simon Belak's avatar Simon Belak
Browse files

Don't strip insights from response in public links

parent c97e4c2a
Branches
Tags
No related merge requests found
......@@ -72,7 +72,7 @@
(binding [api/*current-user-permissions-set* (atom #{"/"})
qp/*allow-queries-with-no-executor-id* true]
(apply card-api/run-query-for-card card-id, :parameters parameters, :context :public-question, options))
(u/select-nested-keys [[:data :columns :cols :rows :rows_truncated] [:json_query :parameters] :error :status]))
(u/select-nested-keys [[:data :columns :cols :rows :rows_truncated :insights] [:json_query :parameters] :error :status]))
;; if the query failed instead of returning anything about the query just return a generic error message
(when (= (:status <>) :failed)
(throw (ex-info "An error occurred while running the query." {:status-code 400})))))
......
......@@ -225,6 +225,24 @@
:target [:dimension [:template-tag :date]]
:value "Q1-2014"}]))))))
;; make sure we include all the relevant fields like `:insights`
(defn- card-with-trendline []
(assoc (shared-obj)
:dataset_query {:database (data/id)
:type :query
:query {:source-table (data/id :checkins)
:breakout [[:datetime-field [:field-id (data/id :checkins :date)] :month]]
:aggregation [[:count]]}}))
(expect
#{:cols :rows :insights :columns}
(tu/with-temporary-setting-values [enable-public-sharing true]
(tt/with-temp Card [{uuid :public_uuid} (card-with-trendline)]
(-> (http/client :get 200 (str "public/card/" uuid "/query"))
:data
keys
set))))
;;; ---------------------------------------- GET /api/public/dashboard/:uuid -----------------------------------------
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment