From 44177d5c0b8bac91cc75705b11e1ef39f956e0ab Mon Sep 17 00:00:00 2001 From: bom Date: Thu, 10 Mar 2022 10:02:17 +0100 Subject: [PATCH] finished POC for filtering by favorited replies --- src/main/dda/masto_embed/app.cljs | 57 ++++++++++++++++++------------- 1 file changed, 34 insertions(+), 23 deletions(-) diff --git a/src/main/dda/masto_embed/app.cljs b/src/main/dda/masto_embed/app.cljs index e0afcf9..f0cf6fb 100644 --- a/src/main/dda/masto_embed/app.cljs +++ b/src/main/dda/masto_embed/app.cljs @@ -59,13 +59,30 @@ first))) out)) -(defn favorited-replies? [host-url reply-id account-name] - (go - (infra/debug (->> - (edn - (filter #(= account-name (:acct %))) - (infra/debug))))) +(defn favorited-replies? [host-url account-name reply-id] + (let [out (chan)] + (go + (>! out + (->> + (edn + (filter #(= account-name (:acct %))) + (empty?) + (not)))) + out)) + +(defn favorited? [host-url account-name replies] + (let [out (chan)] + (go + (>! out + (loop [loc-replies replies + result []] + (if (empty? loc-replies) + result + (recur (rest loc-replies) + (conj result (edn) test-status (-> - (edn) - filtered (filter (favorited-replies? host-url "107779739758156958" "bastian@digitalcourage.social") (:descendants test-status)) + favorited (> statuus ; (take 4) ; (rb/masto->html) ; (render-html) ; (render-to-document)) - ;(go (infra/debug (edn (> filtered - ; (infra/debug) - ; (rb/masto->html) - ; (render-html) - ; (render-to-document)) - ))) - - + (->> filtered + (infra/debug) + (rb/masto->html) + (render-html) + (render-to-document)) + ))) \ No newline at end of file