Skip to content
Snippets Groups Projects
Unverified Commit 5eef8559 authored by Jerry Huang's avatar Jerry Huang Committed by GitHub
Browse files

Fix :has_question_and_dashboard (#32193)

* initial commit

* remove imports

* update test

* fix test

* update test
parent 83c76e6d
Branches
Tags
No related merge requests found
......@@ -30,7 +30,6 @@
[metabase.util.password :as u.password]
[metabase.util.schema :as su]
[schema.core :as s]
[toucan.db :as db]
[toucan2.core :as t2]))
(defsetting user-visibility
......@@ -256,9 +255,8 @@
perms-query {:where [:and
[:= :archived false]
coll-ids-filter]}]
#_{:clj-kondo/ignore [:discouraged-var]}
(assoc user :has_question_and_dashboard (and (db/exists? 'Card (perms-query user))
(db/exists? 'Dashboard (perms-query user))))))
(assoc user :has_question_and_dashboard (and (t2/exists? 'Card perms-query)
(t2/exists? 'Dashboard perms-query)))))
(defn- add-first-login
"Adds `first_login` key to the `User` with the oldest timestamp from that user's login history. Otherwise give the current time, as it's the user's first login."
......
......@@ -314,7 +314,7 @@
(dissoc :is_qbnewb :last_login))
(-> (mt/user-http-request :rasta :get 200 "user/current")
mt/boolean-ids-and-timestamps
(dissoc :is_qbnewb :last_login :has_question_and_dashboard))))))
(dissoc :is_qbnewb :has_question_and_dashboard :last_login))))))
(testing "check that `has_question_and_dashboard` is `true`."
(mt/with-temp* [Dashboard [_ {:name "dash1" :creator_id (mt/user->id :rasta)}]
Card [_ {:name "card1" :display "table" :creator_id (mt/user->id :rasta)}]]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment