0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-22 14:39:45 -05:00

Remember last team accross logouts and sessions and fix some auth weird stuff

This commit is contained in:
Alejandro Alonso 2023-09-04 09:29:58 +02:00
parent e36b49b4f0
commit b8179d0e35
5 changed files with 13 additions and 7 deletions

View file

@ -6,6 +6,7 @@
- Remember last color mode in colorpicker [Taiga #5508](https://tree.taiga.io/project/penpot/issue/5508)
- Improve layers multiselection behaviour [Github #5741](https://github.com/penpot/penpot/issues/5741)
- Remember last active team across logouts / sessions [Github #3325](https://github.com/penpot/penpot/issues/3325)
### :bug: Bugs fixed

View file

@ -59,10 +59,11 @@
ptk/WatchEvent
(watch [_ state stream]
(rx/merge
;;fetch teams must be first in case the team doesn't exist
(ptk/watch (du/fetch-teams) state stream)
(ptk/watch (df/load-team-fonts id) state stream)
(ptk/watch (fetch-projects) state stream)
(ptk/watch (fetch-team-members) state stream)
(ptk/watch (du/fetch-teams) state stream)
(ptk/watch (du/fetch-users {:team-id id}) state stream)
(let [stoper (rx/filter (ptk/type? ::finalize) stream)

View file

@ -125,7 +125,7 @@
accepting invitation, or third party auth signup or singin."
[profile]
(letfn [(get-redirect-event []
(let [team-id (:default-team-id profile)
(let [team-id (get-current-team-id profile)
redirect-url (:redirect-url @storage)]
(if (some? redirect-url)
(do
@ -247,7 +247,9 @@
ptk/EffectEvent
(effect [_ _ _]
(reset! storage {})
;; We prefer to keek some stuff in the storage like the current-team-id
(swap! storage dissoc :redirect-url)
(swap! storage dissoc :profile)
(i18n/reset-locale)))))
(defn logout

View file

@ -153,8 +153,10 @@
(hooks/use-shortcuts ::dashboard sc/shortcuts)
(mf/with-effect [team-id]
(st/emit! (dd/initialize {:id team-id}))
(mf/with-effect [profile team-id]
(when profile
;; When doing logout we must avoid reinitializing the dashboard
(st/emit! (dd/initialize {:id team-id})))
(fn []
(dd/finalize {:id team-id})))

View file

@ -230,8 +230,8 @@
]
(mf/with-effect [collapsed]
(when-not collapsed
(mf/with-effect [profile collapsed]
(when (and profile (not collapsed))
(st/emit! (dd/fetch-builtin-templates))))
[:div.dashboard-templates-section