aboutsummaryrefslogtreecommitdiff
path: root/src/frontend/tau/events.cljs
diff options
context:
space:
mode:
authorMiguel Ángel Moreno <mail@migalmoreno.com>2022-12-31 11:57:10 +0100
committerMiguel Ángel Moreno <mail@migalmoreno.com>2022-12-31 11:57:10 +0100
commit5fc4b8d6edb031cd4a65f788f15832eb659fd2bf (patch)
tree263a62b3ac8fb410797ca3eec0a5e2fb29148157 /src/frontend/tau/events.cljs
parenta4da13d078f254621383f455e91c4ce9ff8c9c4e (diff)
feat: Add support for comment replies
Diffstat (limited to 'src/frontend/tau/events.cljs')
-rw-r--r--src/frontend/tau/events.cljs12
1 files changed, 11 insertions, 1 deletions
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,10 +210,20 @@
(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]]
(-> db