From 5fc4b8d6edb031cd4a65f788f15832eb659fd2bf Mon Sep 17 00:00:00 2001 From: Miguel Ángel Moreno Date: Sat, 31 Dec 2022 11:57:10 +0100 Subject: feat: Add support for comment replies --- src/frontend/tau/events.cljs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/frontend/tau/events.cljs') diff --git a/src/frontend/tau/events.cljs b/src/frontend/tau/events.cljs index d6f9743..12404dc 100644 --- a/src/frontend/tau/events.cljs +++ b/src/frontend/tau/events.cljs @@ -210,9 +210,19 @@ (rf/reg-event-db ::toggle-comments - (fn [db [_ res]] + (fn [db _] (assoc-in db [:stream :show-comments] (not (-> db :stream :show-comments))))) +(rf/reg-event-db + ::toggle-comment-replies + (fn [db [_ comment-id]] + (update-in db [:stream :comments-page :comments] + (fn [comments] + (map #(if (= (:id %) comment-id) + (assoc % :show-replies (not (:show-replies %))) + %) + comments))))) + (rf/reg-event-db ::load-paginated-comments (fn [db [_ res]] -- cgit v1.2.3