Skip to content
Snippets Groups Projects
Unverified Commit f696b25f authored by Noah Moss's avatar Noah Moss Committed by GitHub
Browse files

Don't throw exception when archiving a dashboard in non-root collection (#17670)

parent 01659807
No related branches found
No related tags found
No related merge requests found
......@@ -65,9 +65,10 @@
(defn- pre-update [notification]
(let [{:keys [collection_id dashboard_id]} (db/select-one [Pulse :collection_id :dashboard_id] :id (u/the-id notification))]
(when (and dashboard_id
(contains? notification :collection_id)
(not= (:collection_id notification) collection_id)
(not *allow-moving-dashboard-subscriptions*))
(throw (ex-info (tru "collection ID of dashboard subscription cannot be directly modified") notification)))
(throw (ex-info (tru "collection ID of a dashboard subscription cannot be directly modified") notification)))
(when (and dashboard_id
(contains? notification :dashboard_id)
(not= (:dashboard_id notification) dashboard_id))
......
......@@ -259,9 +259,9 @@
(mt/with-temp* [Collection [{collection-id :id}]
Dashboard [{dashboard-id :id}]
Pulse [{pulse-id :id} {:dashboard_id dashboard-id :collection_id collection-id}]]
(is (thrown-with-msg? Exception #"collection ID of dashboard subscription cannot be directly modified"
(is (thrown-with-msg? Exception #"collection ID of a dashboard subscription cannot be directly modified"
(db/update! Pulse pulse-id {:collection_id (inc collection-id)})))
(is (thrown-with-msg? Exception #"collection ID of dashboard subscription cannot be directly modified"
(is (thrown-with-msg? Exception #"dashboard ID of a dashboard subscription cannot be modified"
(db/update! Pulse pulse-id {:dashboard_id (inc dashboard-id)}))))))
(deftest no-archived-cards-test
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment