From 150427cd395769e1f1f3e7df6c054beb4e8b45a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Moya?= Date: Thu, 24 Jun 2021 15:39:12 +0200 Subject: [PATCH] :bug: Fix contextual menu in dashboard shared libraries section --- CHANGES.md | 1 + frontend/src/app/main/data/dashboard.cljs | 13 +++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 5a8a851d6..616273517 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -20,6 +20,7 @@ - Fix dashboard navigation on moving file to other team [Taiga #1817](https://tree.taiga.io/project/penpot/issue/1817). - Fix workspace header presence styles and invalid link [Taiga #1813](https://tree.taiga.io/project/penpot/issue/1813). - Fix color-input wrong behavior (on workspace page color) [Taiga #1795](https://tree.taiga.io/project/penpot/issue/1795). +- Fix file contextual menu in shared libraries at dashboard [Taiga #1865](https://tree.taiga.io/project/penpot/issue/1865). ### :arrow_up: Deps updates ### :boom: Breaking changes diff --git a/frontend/src/app/main/data/dashboard.cljs b/frontend/src/app/main/data/dashboard.cljs index b55b5cab0..96bf7c077 100644 --- a/frontend/src/app/main/data/dashboard.cljs +++ b/frontend/src/app/main/data/dashboard.cljs @@ -73,6 +73,7 @@ (-> (assoc :current-team-id id) (dissoc :dashboard-files) (dissoc :dashboard-projects) + (dissoc :dashboard-shared-files) (dissoc :dashboard-recent-files) (dissoc :dashboard-team-members) (dissoc :dashboard-team-stats))))) @@ -206,7 +207,10 @@ (ptk/reify ::shared-files-fetched ptk/UpdateEvent (update [_ state] - (assoc state :dashboard-shared-files (d/index-by :id files))))) + (let [files (d/index-by :id files)] + (-> state + (assoc :dashboard-shared-files files) + (update :dashboard-files d/merge files)))))) (defn fetch-shared-files [] @@ -548,6 +552,7 @@ (update [_ state] (-> state (d/update-when :dashboard-files dissoc id) + (d/update-when :dashboard-shared-files dissoc id) (d/update-when :dashboard-recent-files dissoc id))) ptk/WatchEvent @@ -566,6 +571,7 @@ (update [_ state] (-> state (d/update-in-when [:dashboard-files id :name] (constantly name)) + (d/update-in-when [:dashboard-shared-files id :name] (constantly name)) (d/update-in-when [:dashboard-recent-files id :name] (constantly name)))) ptk/WatchEvent @@ -584,7 +590,10 @@ (update [_ state] (-> state (d/update-in-when [:dashboard-files id :is-shared] (constantly is-shared)) - (d/update-in-when [:dashboard-recent-files id :is-shared] (constantly is-shared)))) + (d/update-in-when [:dashboard-recent-files id :is-shared] (constantly is-shared)) + (cond-> + (not is-shared) + (d/update-when :dashboard-shared-files dissoc id)))) ptk/WatchEvent (watch [_ _ _]