From 22e64c1c81ebd3e9351f7034eadb30f912371db9 Mon Sep 17 00:00:00 2001 From: Pablo Alba Date: Mon, 25 Nov 2024 16:26:14 +0100 Subject: [PATCH] :sparkles: Add event "resolve-comment-thread" --- frontend/src/app/main/data/comments.cljs | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/frontend/src/app/main/data/comments.cljs b/frontend/src/app/main/data/comments.cljs index 3b7dfba2b..d4333d594 100644 --- a/frontend/src/app/main/data/comments.cljs +++ b/frontend/src/app/main/data/comments.cljs @@ -195,13 +195,16 @@ ptk/WatchEvent (watch [_ state _] (let [share-id (-> state :viewer-local :share-id)] - (->> (rp/cmd! :update-comment-thread {:id id :is-resolved is-resolved :share-id share-id}) - (rx/catch (fn [{:keys [type code] :as cause}] - (if (and (= type :restriction) - (= code :max-quote-reached)) - (rx/throw cause) - (rx/throw {:type :comment-error})))) - (rx/ignore)))))) + (rx/concat + (when is-resolved (rx/of + (ptk/event ::ev/event {::ev/name "resolve-comment-thread" :thread-id id}))) + (->> (rp/cmd! :update-comment-thread {:id id :is-resolved is-resolved :share-id share-id}) + (rx/catch (fn [{:keys [type code] :as cause}] + (if (and (= type :restriction) + (= code :max-quote-reached)) + (rx/throw cause) + (rx/throw {:type :comment-error})))) + (rx/ignore))))))) (defn add-comment [thread content]