postCommentsR :: SiteId -> Handler Value
postCommentsR siteId = do
    allowCrossOrigin

    u <- requireAuth
    t <- liftIO getCurrentTime
    c <- fmap (buildComment t u siteId) requireJsonBody

    runValidation validateComment c $ \v -> do
        userComment <- runDB $ do
            commentId <- insert v
            buildUserComment (Entity commentId v) u

        let notification = NewComment userComment

        runDB $ subscribe (notificationName notification) $ entityKey u

        sendNotification notification
        sendResponseStatus status201 $ object ["comment" .= userComment]
postCommentsR :: SiteId -> Handler Value
postCommentsR siteId = do
    allowCrossOrigin

    u <- requireAuth
    t <- liftIO getCurrentTime
    c <- fmap (buildComment t u siteId) requireJsonBody

    runValidation validateComment c $ \v -> do
        userComment <- runDB $ do
            commentId <- insert v
            buildUserComment (Entity commentId v) u

        let notification = NewComment userComment

        runDB $ subscribe (notificationName notification) $ entityKey u

        sendNotification notification
        sendResponseStatus status201 $ object ["comment" .= userComment]
postCommentsR siteId = do
    allowCrossOrigin

    u <- requireAuth
    t <- liftIO getCurrentTime
    c <- fmap (buildComment t u siteId) requireJsonBody

    runValidation validateComment c $ \v -> do
        userComment <- runDB $ do
            commentId <- insert v
            buildUserComment (Entity commentId v) u

        let notification = NewComment userComment

        runDB $ subscribe (notificationName notification) $ entityKey u

        sendNotification notification
        sendResponseStatus status201 $ object ["comment" .= userComment]