0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-22 14:39:45 -05:00

Add event "resolve-comment-thread"

This commit is contained in:
Pablo Alba 2024-11-25 16:26:14 +01:00
parent 14c917d003
commit 22e64c1c81

View file

@ -195,13 +195,16 @@
ptk/WatchEvent ptk/WatchEvent
(watch [_ state _] (watch [_ state _]
(let [share-id (-> state :viewer-local :share-id)] (let [share-id (-> state :viewer-local :share-id)]
(->> (rp/cmd! :update-comment-thread {:id id :is-resolved is-resolved :share-id share-id}) (rx/concat
(rx/catch (fn [{:keys [type code] :as cause}] (when is-resolved (rx/of
(if (and (= type :restriction) (ptk/event ::ev/event {::ev/name "resolve-comment-thread" :thread-id id})))
(= code :max-quote-reached)) (->> (rp/cmd! :update-comment-thread {:id id :is-resolved is-resolved :share-id share-id})
(rx/throw cause) (rx/catch (fn [{:keys [type code] :as cause}]
(rx/throw {:type :comment-error})))) (if (and (= type :restriction)
(rx/ignore)))))) (= code :max-quote-reached))
(rx/throw cause)
(rx/throw {:type :comment-error}))))
(rx/ignore)))))))
(defn add-comment (defn add-comment
[thread content] [thread content]