From 1b2a38351d45d0439f62990dbac0796b284b74c7 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Fri, 13 Dec 2024 09:13:28 +0100 Subject: [PATCH 1/5] :bug: Fix invitations and webhooks page shows no data Regression of the routing/state refactor --- frontend/src/app/main/ui/dashboard/team.cljs | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/frontend/src/app/main/ui/dashboard/team.cljs b/frontend/src/app/main/ui/dashboard/team.cljs index ce2b9b791..bf82855e8 100644 --- a/frontend/src/app/main/ui/dashboard/team.cljs +++ b/frontend/src/app/main/ui/dashboard/team.cljs @@ -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 From eaec46a67b8d15900e0c2fbf19829de75df59795 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Fri, 13 Dec 2024 10:22:40 +0100 Subject: [PATCH 2/5] :bug: Fix incorrect team invitation redirect after login --- frontend/src/app/main/data/auth.cljs | 36 +++++++++++++----------- frontend/src/app/main/ui/auth/login.cljs | 11 ++------ 2 files changed, 21 insertions(+), 26 deletions(-) diff --git a/frontend/src/app/main/data/auth.cljs b/frontend/src/app/main/data/auth.cljs index c1ba640b5..740946b24 100644 --- a/frontend/src/app/main/data/auth.cljs +++ b/frontend/src/app/main/data/auth.cljs @@ -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 diff --git a/frontend/src/app/main/ui/auth/login.cljs b/frontend/src/app/main/ui/auth/login.cljs index e30b25957..10bf80d3b 100644 --- a/frontend/src/app/main/ui/auth/login.cljs +++ b/frontend/src/app/main/ui/auth/login.cljs @@ -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 From 585c273cd661cc30be95095cf288f02828c752ce Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Mon, 23 Dec 2024 12:20:03 +0100 Subject: [PATCH 3/5] :bug: Fix dashboard fonts section nav link --- frontend/src/app/main/data/common.cljs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/app/main/data/common.cljs b/frontend/src/app/main/data/common.cljs index 925c31467..f1ff93055 100644 --- a/frontend/src/app/main/data/common.cljs +++ b/frontend/src/app/main/data/common.cljs @@ -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}] From 8d74d82fd0c2f865e98927807cfedecd08639cf0 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Mon, 23 Dec 2024 12:39:49 +0100 Subject: [PATCH 4/5] :arrow_up: Update potok dependency Improves internal symbol naming for objects created with ptk/reify. Helps on debugging --- frontend/deps.edn | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/deps.edn b/frontend/deps.edn index 8febd1edd..67e2de069 100644 --- a/frontend/deps.edn +++ b/frontend/deps.edn @@ -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]} From 2b31613853e45d55d46e29a72e8af10b6fb3db51 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Mon, 23 Dec 2024 12:40:40 +0100 Subject: [PATCH 5/5] :bug: Fix file deletion exception --- frontend/src/app/main/data/dashboard.cljs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/frontend/src/app/main/data/dashboard.cljs b/frontend/src/app/main/data/dashboard.cljs index 49756a559..54f64e965 100644 --- a/frontend/src/app/main/data/dashboard.cljs +++ b/frontend/src/app/main/data/dashboard.cljs @@ -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