diff --git a/CHANGES.md b/CHANGES.md index ef505d3dc..0d6109fd6 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -44,6 +44,7 @@ - Fix path options not showing when editing rects or ellipses [Taiga #5053](https://tree.taiga.io/project/penpot/issue/5053) - Fix tooltips for some alignment options are truncated on design tab [Taiga #5040](https://tree.taiga.io/project/penpot/issue/5040) - Fix horizontal margins drag don't always start from place [Taiga #5020](https://tree.taiga.io/project/penpot/issue/5020) +- Fix multiplayer username sometimes is not displayed correctly [Taiga #4400](https://tree.taiga.io/project/penpot/issue/4400) ### :heart: Community contributions by (Thank you!) - To @ondrejkonec: for contributing to the code with: diff --git a/frontend/src/app/main/data/comments.cljs b/frontend/src/app/main/data/comments.cljs index 637edce3b..f7904d520 100644 --- a/frontend/src/app/main/data/comments.cljs +++ b/frontend/src/app/main/data/comments.cljs @@ -279,15 +279,19 @@ (-> (assoc-in (conj path :position) (:position comment-thread)) (assoc-in (conj path :frame-id) (:frame-id comment-thread)))))) - (fetched [data state] - (let [state (assoc state :comment-threads (d/index-by :id data))] - (reduce set-comment-threds state data)))] + (fetched [[users comments] state] + (let [state (-> state + (assoc :comment-threads (d/index-by :id comments)) + (assoc :current-file-comments-users (d/index-by :id users)))] + (reduce set-comment-threds state comments)))] (ptk/reify ::retrieve-comment-threads ptk/WatchEvent (watch [_ state _] (let [share-id (-> state :viewer-local :share-id)] - (->> (rp/cmd! :get-comment-threads {:file-id file-id :share-id share-id}) + (->> (rx/zip (rp/cmd! :get-team-users {:file-id file-id}) + (rp/cmd! :get-comment-threads {:file-id file-id :share-id share-id})) + (rx/take 1) (rx/map #(partial fetched %)) (rx/catch #(rx/throw {:type :comment-error}))))))))