0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-04 13:50:12 -05:00

Merge pull request #5467 from penpot/niwinz-bugfix-4

🐛 Fix invitations and webhooks page shows no data
This commit is contained in:
Pablo Alba 2024-12-27 13:51:24 +01:00 committed by GitHub
commit e683564ab2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 30 additions and 43 deletions

View file

@ -9,8 +9,8 @@
funcool/okulary {:mvn/version "2022.04.11-16"} funcool/okulary {:mvn/version "2022.04.11-16"}
funcool/potok2 funcool/potok2
{:git/tag "v2.1" {:git/tag "v2.2"
:git/sha "84c97b9" :git/sha "0f7e15a"
:git/url "https://github.com/funcool/potok.git" :git/url "https://github.com/funcool/potok.git"
:exclusions [funcool/beicon2]} :exclusions [funcool/beicon2]}

View file

@ -39,24 +39,26 @@
accepting invitation, or third party auth signup or singin." accepting invitation, or third party auth signup or singin."
[{:keys [props] :as profile}] [{:keys [props] :as profile}]
(letfn [(get-redirect-events [teams] (letfn [(get-redirect-events [teams]
(if-let [redirect-href (:login-redirect storage/session)] (if-let [token (:invitation-token profile)]
(binding [storage/*sync* true] (rx/of (rt/nav :auth-verify-token {:token token}))
(swap! storage/session dissoc :login-redirect) (if-let [redirect-href (:login-redirect storage/session)]
(if (= redirect-href (rt/get-current-href)) (binding [storage/*sync* true]
(rx/of (rt/reload true)) (swap! storage/session dissoc :login-redirect)
(rx/of (rt/nav-raw :href redirect-href)))) (if (= redirect-href (rt/get-current-href))
(if-let [file-id (get props :welcome-file-id)] (rx/of (rt/reload true))
(rx/of (dcm/go-to-workspace (rx/of (rt/nav-raw :href redirect-href))))
:file-id file-id (if-let [file-id (get props :welcome-file-id)]
:team-id (:default-team-id profile)) (rx/of (dcm/go-to-workspace
(dp/update-profile-props {:welcome-file-id nil})) :file-id file-id
:team-id (:default-team-id profile))
(dp/update-profile-props {:welcome-file-id nil}))
(let [teams (into #{} (map :id) teams) (let [teams (into #{} (map :id) teams)
team-id (dtm/get-last-team-id) team-id (dtm/get-last-team-id)
team-id (if (and team-id (contains? teams team-id)) team-id (if (and team-id (contains? teams team-id))
team-id team-id
(:default-team-id profile))] (:default-team-id profile))]
(rx/of (dcm/go-to-dashboard-recent {:team-id team-id}))))))] (rx/of (dcm/go-to-dashboard-recent {:team-id team-id})))))))]
(ptk/reify ::logged-in (ptk/reify ::logged-in
ev/Event ev/Event

View file

@ -307,7 +307,7 @@
ptk/WatchEvent ptk/WatchEvent
(watch [_ state _] (watch [_ state _]
(let [team-id (or team-id (:current-team-id 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 (defn go-to-dashboard-recent
[& {:keys [team-id] :as options}] [& {:keys [team-id] :as options}]

View file

@ -361,7 +361,7 @@
;; --- EVENT: delete-file ;; --- EVENT: delete-file
(defn file-deleted (defn file-deleted
[_team-id project-id] [project-id]
(ptk/reify ::file-deleted (ptk/reify ::file-deleted
ptk/UpdateEvent ptk/UpdateEvent
(update [_ state] (update [_ state]
@ -378,10 +378,9 @@
(d/update-when :recent-files dissoc id))) (d/update-when :recent-files dissoc id)))
ptk/WatchEvent ptk/WatchEvent
(watch [_ state _] (watch [_ _ _]
(let [team-id (uuid/uuid (get-in state [:route :path-params :team-id]))] (->> (rp/cmd! :delete-file {:id id})
(->> (rp/cmd! :delete-file {:id id}) (rx/map (partial file-deleted project-id))))))
(rx/map #(file-deleted team-id project-id)))))))
;; --- Rename File ;; --- Rename File

View file

@ -120,17 +120,10 @@
:else :else
(reset! error (tr "errors.generic"))))) (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 on-success
(fn [data] (fn [data]
(if (nil? on-success-callback) (when (fn? on-success-callback)
(on-success-default data) (on-success-callback data)))
(on-success-callback)))
on-submit on-submit
(mf/use-callback (mf/use-callback

View file

@ -31,7 +31,6 @@
[app.util.i18n :as i18n :refer [tr]] [app.util.i18n :as i18n :refer [tr]]
[beicon.v2.core :as rx] [beicon.v2.core :as rx]
[cuerdas.core :as str] [cuerdas.core :as str]
[okulary.core :as l]
[rumext.v2 :as mf])) [rumext.v2 :as mf]))
(def ^:private arrow-icon (def ^:private arrow-icon
@ -743,15 +742,12 @@
[:> i18n/tr-html* {:content (tr "labels.no-invitations-hint") [:> i18n/tr-html* {:content (tr "labels.no-invitations-hint")
:tag-name "span"}])]) :tag-name "span"}])])
(def ^:private ref:invitations
(l/derived :invitations st/state))
(mf/defc invitation-section* (mf/defc invitation-section*
{::mf/props :obj {::mf/props :obj
::mf/private true} ::mf/private true}
[{:keys [team]}] [{:keys [team]}]
(let [permissions (get team :permissions) (let [permissions (get team :permissions)
invitations (mf/deref ref:invitations) invitations (get team :invitations)
team-id (get team :id) team-id (get team :id)
@ -1037,13 +1033,10 @@
:key (dm/str (:id webhook)) :key (dm/str (:id webhook))
:permissions permissions}])]) :permissions permissions}])])
(def ^:private ref:webhooks
(l/derived :webhooks st/state))
(mf/defc webhooks-page* (mf/defc webhooks-page*
{::mf/props :obj} {::mf/props :obj}
[{:keys [team]}] [{:keys [team]}]
(let [webhooks (mf/deref ref:webhooks)] (let [webhooks (:webhooks team)]
(mf/with-effect [team] (mf/with-effect [team]
(dom/set-html-title (dom/set-html-title