diff --git a/CHANGES.md b/CHANGES.md index f6e0c7250..d4daeef64 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -72,6 +72,7 @@ - Fix bad frame-id for certain componentes [#3205](https://github.com/penpot/penpot/issues/3205) - Fix paste elements at bottom of frame [Taig #5253](https://tree.taiga.io/project/penpot/issue/5253) - Fix new-file button on project not redirecting to the new file [Taiga #5610](https://tree.taiga.io/project/penpot/issue/5610) +- Fix retrieve user comments in dashboard [Taiga #5607](https://tree.taiga.io/project/penpot/issue/5607) ### :arrow_up: Deps updates diff --git a/frontend/src/app/main/data/comments.cljs b/frontend/src/app/main/data/comments.cljs index 65f409178..225ddae8b 100644 --- a/frontend/src/app/main/data/comments.cljs +++ b/frontend/src/app/main/data/comments.cljs @@ -314,9 +314,18 @@ (ptk/reify ::retrieve-unread-comment-threads ptk/WatchEvent (watch [_ _ _] - (let [fetched #(assoc %2 :comment-threads (d/index-by :id %1))] + (let [fetched-comments #(assoc %2 :comment-threads (d/index-by :id %1)) + fetched-users #(assoc %2 :current-team-comments-users %1)] (->> (rp/cmd! :get-unread-comment-threads {:team-id team-id}) - (rx/map #(partial fetched %)) + (rx/merge-map + (fn [comments] + (rx/concat + (rx/of (partial fetched-comments comments)) + + (->> (rx/from (map :file-id comments)) + (rx/merge-map #(rp/cmd! :get-profiles-for-file-comments {:file-id %})) + (rx/reduce #(merge %1 (d/index-by :id %2)) {}) + (rx/map #(partial fetched-users %)))))) (rx/catch #(rx/throw {:type :comment-error}))))))) diff --git a/frontend/src/app/main/refs.cljs b/frontend/src/app/main/refs.cljs index bcb78e7a4..7f7e4bc75 100644 --- a/frontend/src/app/main/refs.cljs +++ b/frontend/src/app/main/refs.cljs @@ -459,6 +459,9 @@ (def current-file-comments-users (l/derived :current-file-comments-users st/state)) +(def current-team-comments-users + (l/derived :current-team-comments-users st/state)) + (def viewer-fullscreen? (l/derived (fn [state] (dm/get-in state [:viewer-local :fullscreen?])) diff --git a/frontend/src/app/main/ui/dashboard/comments.cljs b/frontend/src/app/main/ui/dashboard/comments.cljs index c03518fb9..2da270779 100644 --- a/frontend/src/app/main/ui/dashboard/comments.cljs +++ b/frontend/src/app/main/ui/dashboard/comments.cljs @@ -32,7 +32,7 @@ show-dropdown (mf/use-fn #(reset! show-dropdown? true)) hide-dropdown (mf/use-fn #(reset! show-dropdown? false)) threads-map (mf/deref refs/comment-threads) - users (mf/deref refs/current-file-comments-users) + users (mf/deref refs/current-team-comments-users) tgroups (->> (vals threads-map) (sort-by :modified-at)