Commits

Luke Plant committed 528db92

Make category post feed respect feed_post_page_size

  • Participants
  • Parent commits 8e52a8e

Comments (0)

Files changed (3)

src/Blog/Model.hs

   (res,more) <- pagedQuery cn getRecentPostsQuery [] page pagesize
   return (map makePost res, more)
 
-getPostsForCategory :: (IConnection conn) => conn -> Ct.Category -> Int -> IO ([P.Post], Bool)
-getPostsForCategory cn cat curpage = do
-  (res,more) <- pagedQuery cn getPostsForCategoryQuery [toSql $ Ct.uid cat] curpage Settings.post_page_size
+getPostsForCategory :: (IConnection conn) => conn -> Ct.Category -> Int -> Int -> IO ([P.Post], Bool)
+getPostsForCategory cn cat page pagesize = do
+  (res,more) <- pagedQuery cn getPostsForCategoryQuery [toSql $ Ct.uid cat] page pagesize
   return (map makePost res, more)
 
 -- | Returns all recent comments, paired with the Post they are from

src/Blog/Views.hs

   case mcat of
     Nothing -> return404 req
     Just cat -> do
-              (posts,more) <- getPostsForCategory cn cat (getPage req)
+              (posts,more) <- getPostsForCategory cn cat (getPage req) Settings.post_page_size
               cats <- getCategoriesBulk cn posts
               t <- get_template "category"
               return $ Just $ standardResponseTT req $
   case mcat of
     Nothing -> return404 req
     Just cat -> do
-              (posts,more) <- getPostsForCategory cn cat 1
+              (posts,more) <- getPostsForCategory cn cat 1 Settings.feed_post_page_size
               feedResponse $ categoryPostsFeed cat posts
 
 -- | View that shows individual post
 -- up.  They are only announcements, so we just delete.
 deleteArticlePosts cn = do
   Just cat <- getCategoryBySlug cn "articles"
-  (posts, False) <- getPostsForCategory cn cat 1 -- there is only one page worth
+  (posts, False) <- getPostsForCategory cn cat 1 20 -- there are less than 20
   deleteCategory cn (C.uid cat)
   mapM_ (\x -> deletePost cn $ P.uid x) posts