fix comment loading

master
Clyne 1 year ago
parent 16d879c632
commit 174d96bd2c
Signed by: clyne
GPG Key ID: 1B74EE6C49C96795

@ -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]

Loading…
Cancel
Save