From 174d96bd2c35b9954a7b506aa77384f559de9fb0 Mon Sep 17 00:00:00 2001 From: Clyne Sullivan Date: Tue, 11 Jul 2023 07:34:56 -0400 Subject: [PATCH] fix comment loading --- src/lemmold/core.clj | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/lemmold/core.clj b/src/lemmold/core.clj index 6528e51..73f96f7 100644 --- a/src/lemmold/core.clj +++ b/src/lemmold/core.clj @@ -22,7 +22,7 @@ (defn comments-list [post] (-> (make-api-url INSTANCE COMMENTS) - (api-call {:id (get-in post ["post" "id"])}) + (api-call {:post_id (str (get-in post ["post" "id"]))}) (get "comments"))) (defn show-post-item [post] @@ -34,7 +34,6 @@ (defn show-comment-item [commnt] (println (get-in commnt ["creator" "name"]) "says:") - (println (get-in commnt ["comment" "content"])) (println) ) @@ -52,20 +51,20 @@ (first (read-line))) (defn show-comments-prompt [] - (print "BNPQ> ") + (print "BNP> ") (flush) (first (read-line))) (defn view-post [post] (println "Viewing post id:" (get-in post ["post" "id"])) - (loop [offset 0 comments (comments-list (get-in post ["post" "id"]))] + (loop [offset 0 comments (comments-list post)] + (println (count comments) offset) (show-comments (if (pos? offset) (drop (* 5 offset) comments) comments)) (flush) (case (show-comments-prompt) \B (println) \N (recur (inc offset) comments) \P (recur (dec offset) comments) - \Q (println "Goodbye.") (do (println "Unknown command.") (recur offset comments))))) (defn -main [& args]