mirror of
https://github.com/penpot/penpot.git
synced 2025-01-02 04:40:09 -05:00
Merge pull request #5467 from penpot/niwinz-bugfix-4
🐛 Fix invitations and webhooks page shows no data
This commit is contained in:
commit
e683564ab2
6 changed files with 30 additions and 43 deletions
|
@ -9,8 +9,8 @@
|
|||
funcool/okulary {:mvn/version "2022.04.11-16"}
|
||||
|
||||
funcool/potok2
|
||||
{:git/tag "v2.1"
|
||||
:git/sha "84c97b9"
|
||||
{:git/tag "v2.2"
|
||||
:git/sha "0f7e15a"
|
||||
:git/url "https://github.com/funcool/potok.git"
|
||||
:exclusions [funcool/beicon2]}
|
||||
|
||||
|
|
|
@ -39,24 +39,26 @@
|
|||
accepting invitation, or third party auth signup or singin."
|
||||
[{:keys [props] :as profile}]
|
||||
(letfn [(get-redirect-events [teams]
|
||||
(if-let [redirect-href (:login-redirect storage/session)]
|
||||
(binding [storage/*sync* true]
|
||||
(swap! storage/session dissoc :login-redirect)
|
||||
(if (= redirect-href (rt/get-current-href))
|
||||
(rx/of (rt/reload true))
|
||||
(rx/of (rt/nav-raw :href redirect-href))))
|
||||
(if-let [file-id (get props :welcome-file-id)]
|
||||
(rx/of (dcm/go-to-workspace
|
||||
:file-id file-id
|
||||
:team-id (:default-team-id profile))
|
||||
(dp/update-profile-props {:welcome-file-id nil}))
|
||||
(if-let [token (:invitation-token profile)]
|
||||
(rx/of (rt/nav :auth-verify-token {:token token}))
|
||||
(if-let [redirect-href (:login-redirect storage/session)]
|
||||
(binding [storage/*sync* true]
|
||||
(swap! storage/session dissoc :login-redirect)
|
||||
(if (= redirect-href (rt/get-current-href))
|
||||
(rx/of (rt/reload true))
|
||||
(rx/of (rt/nav-raw :href redirect-href))))
|
||||
(if-let [file-id (get props :welcome-file-id)]
|
||||
(rx/of (dcm/go-to-workspace
|
||||
:file-id file-id
|
||||
:team-id (:default-team-id profile))
|
||||
(dp/update-profile-props {:welcome-file-id nil}))
|
||||
|
||||
(let [teams (into #{} (map :id) teams)
|
||||
team-id (dtm/get-last-team-id)
|
||||
team-id (if (and team-id (contains? teams team-id))
|
||||
team-id
|
||||
(:default-team-id profile))]
|
||||
(rx/of (dcm/go-to-dashboard-recent {:team-id team-id}))))))]
|
||||
(let [teams (into #{} (map :id) teams)
|
||||
team-id (dtm/get-last-team-id)
|
||||
team-id (if (and team-id (contains? teams team-id))
|
||||
team-id
|
||||
(:default-team-id profile))]
|
||||
(rx/of (dcm/go-to-dashboard-recent {:team-id team-id})))))))]
|
||||
|
||||
(ptk/reify ::logged-in
|
||||
ev/Event
|
||||
|
|
|
@ -307,7 +307,7 @@
|
|||
ptk/WatchEvent
|
||||
(watch [_ state _]
|
||||
(let [team-id (or team-id (:current-team-id state))]
|
||||
(rx/of (rt/nav :dashboard-libraries {:team-id team-id}))))))
|
||||
(rx/of (rt/nav :dashboard-fonts {:team-id team-id}))))))
|
||||
|
||||
(defn go-to-dashboard-recent
|
||||
[& {:keys [team-id] :as options}]
|
||||
|
|
|
@ -361,7 +361,7 @@
|
|||
;; --- EVENT: delete-file
|
||||
|
||||
(defn file-deleted
|
||||
[_team-id project-id]
|
||||
[project-id]
|
||||
(ptk/reify ::file-deleted
|
||||
ptk/UpdateEvent
|
||||
(update [_ state]
|
||||
|
@ -378,10 +378,9 @@
|
|||
(d/update-when :recent-files dissoc id)))
|
||||
|
||||
ptk/WatchEvent
|
||||
(watch [_ state _]
|
||||
(let [team-id (uuid/uuid (get-in state [:route :path-params :team-id]))]
|
||||
(->> (rp/cmd! :delete-file {:id id})
|
||||
(rx/map #(file-deleted team-id project-id)))))))
|
||||
(watch [_ _ _]
|
||||
(->> (rp/cmd! :delete-file {:id id})
|
||||
(rx/map (partial file-deleted project-id))))))
|
||||
|
||||
;; --- Rename File
|
||||
|
||||
|
|
|
@ -120,17 +120,10 @@
|
|||
:else
|
||||
(reset! error (tr "errors.generic")))))
|
||||
|
||||
on-success-default
|
||||
(mf/use-fn
|
||||
(fn [data]
|
||||
(when-let [token (:invitation-token data)]
|
||||
(st/emit! (rt/nav :auth-verify-token {:token token})))))
|
||||
|
||||
on-success
|
||||
(fn [data]
|
||||
(if (nil? on-success-callback)
|
||||
(on-success-default data)
|
||||
(on-success-callback)))
|
||||
(when (fn? on-success-callback)
|
||||
(on-success-callback data)))
|
||||
|
||||
on-submit
|
||||
(mf/use-callback
|
||||
|
|
|
@ -31,7 +31,6 @@
|
|||
[app.util.i18n :as i18n :refer [tr]]
|
||||
[beicon.v2.core :as rx]
|
||||
[cuerdas.core :as str]
|
||||
[okulary.core :as l]
|
||||
[rumext.v2 :as mf]))
|
||||
|
||||
(def ^:private arrow-icon
|
||||
|
@ -743,15 +742,12 @@
|
|||
[:> i18n/tr-html* {:content (tr "labels.no-invitations-hint")
|
||||
:tag-name "span"}])])
|
||||
|
||||
(def ^:private ref:invitations
|
||||
(l/derived :invitations st/state))
|
||||
|
||||
(mf/defc invitation-section*
|
||||
{::mf/props :obj
|
||||
::mf/private true}
|
||||
[{:keys [team]}]
|
||||
(let [permissions (get team :permissions)
|
||||
invitations (mf/deref ref:invitations)
|
||||
invitations (get team :invitations)
|
||||
|
||||
team-id (get team :id)
|
||||
|
||||
|
@ -1037,13 +1033,10 @@
|
|||
:key (dm/str (:id webhook))
|
||||
:permissions permissions}])])
|
||||
|
||||
(def ^:private ref:webhooks
|
||||
(l/derived :webhooks st/state))
|
||||
|
||||
(mf/defc webhooks-page*
|
||||
{::mf/props :obj}
|
||||
[{:keys [team]}]
|
||||
(let [webhooks (mf/deref ref:webhooks)]
|
||||
(let [webhooks (:webhooks team)]
|
||||
|
||||
(mf/with-effect [team]
|
||||
(dom/set-html-title
|
||||
|
|
Loading…
Reference in a new issue