         parent-id (if (empty? (:parent_id params))
                     nil
                     (Integer/parseInt (:parent_id params)))
-        post (first (get-post-by-id post-id))
+        post (first (get-post-by-id db post-id))
         identity (friend/identity req)
-        user (first (get-user-by-username (:current identity)))]
-    (create-comment! (:content params)
+        user (first (get-user-by-username db (:current identity)))]
+    (create-comment! db
+                     (:content params)
                      (:id user)
                      post-id
                      parent-id)

(defn post-post [req]
  (let [params (:params req)
        identity (friend/identity req)
        user (first (get-user-by-username (:current identity)))
        post (create-post! (:title params)
                           (if (empty? (:url params))
                             nil
                             (:url params))

  (let [params (:params req)
        post-id (Integer/parseInt (:post_id params))
        comment-id (Integer/parseInt (:comment_id params))
        post (first (get-post-by-id db post-id))
        comment (first (get-comment-by-id db comment-id))]
    (wrap-view req views/show-comment {:post post :comment comment})))
