]> code.bitgloo.com Git - clyne/lemmold.git/commitdiff
fix comment loading
authorClyne Sullivan <clyne@bitgloo.com>
Tue, 11 Jul 2023 11:34:56 +0000 (07:34 -0400)
committerClyne Sullivan <clyne@bitgloo.com>
Tue, 11 Jul 2023 11:34:56 +0000 (07:34 -0400)
src/lemmold/core.clj

index 6528e517567bae8c2a5421c931c7838736d80dd6..73f96f7a0d4646df050d5bf3951e09db5cf8293b 100644 (file)
@@ -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)
   )
 
   (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]