mirror of
https://github.com/penpot/penpot.git
synced 2025-06-03 13:01:40 +02:00
🐛 Fix incorrect handling request access with deleted profiles
* 📎 Add minor improvements to team tests * 🐛 Fix incorrect handling request access with deleted profiles * 🐛 Fix redirect loop on empty route Happens when the current profile is deleted from team * 🐛 Fix urls on request access emails * 📎 Revert url changes on emails
This commit is contained in:
parent
19bae05f41
commit
4744085426
13 changed files with 166 additions and 62 deletions
|
@ -72,6 +72,7 @@
|
|||
(def profile-fetched?
|
||||
(ptk/type? ::profile-fetched))
|
||||
|
||||
;; FIXME: make it as general purpose handler, not only on profile
|
||||
(defn- on-fetch-profile-exception
|
||||
[cause]
|
||||
(let [data (ex-data cause)]
|
||||
|
|
|
@ -109,7 +109,11 @@
|
|||
;; avoids some race conditions that causes unexpected redirects
|
||||
;; on invitations workflows (and probably other cases).
|
||||
(->> (rp/cmd! :get-profile)
|
||||
(rx/subs! (fn [{:keys [id] :as profile}]
|
||||
(rx/mapcat (fn [profile]
|
||||
(->> (rp/cmd! :get-teams {})
|
||||
(rx/map (fn [teams]
|
||||
(assoc profile ::teams (into #{} (map :id) teams)))))))
|
||||
(rx/subs! (fn [{:keys [id ::teams] :as profile}]
|
||||
(cond
|
||||
(= id uuid/zero)
|
||||
(do
|
||||
|
@ -117,10 +121,12 @@
|
|||
(st/emit! (rt/nav :auth-login)))
|
||||
|
||||
empty-path?
|
||||
(let [team-id (or (dtm/get-last-team-id)
|
||||
(:default-team-id profile))]
|
||||
(st/emit! (rt/nav :dashboard-recent
|
||||
(assoc query-params :team-id team-id))))
|
||||
(let [team-id (dtm/get-last-team-id)]
|
||||
(if (contains? teams team-id)
|
||||
(st/emit! (rt/nav :dashboard-recent
|
||||
(assoc query-params :team-id team-id)))
|
||||
(st/emit! (rt/nav :dashboard-recent
|
||||
(assoc query-params :team-id (:default-team-id profile))))))
|
||||
|
||||
:else
|
||||
(st/emit! (rt/assign-exception {:type :not-found})))))))))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue