From 038e4a3399227d45880ad029f1aa0f4185dfbb86 Mon Sep 17 00:00:00 2001 From: nek0 Date: Fri, 19 Dec 2014 22:36:15 +0100 Subject: [PATCH] added userfeed --- Handler/RootFeed.hs | 18 +++++++++++++++++- config/routes | 2 ++ templates/profile.hamlet | 4 ++++ 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/Handler/RootFeed.hs b/Handler/RootFeed.hs index afc0ba8..f93f4d7 100644 --- a/Handler/RootFeed.hs +++ b/Handler/RootFeed.hs @@ -185,9 +185,25 @@ getCommentFeedR :: RepFeed a => MediumId -> Handler a getCommentFeedR mediumId = do medium <- runDB $ get404 mediumId url <- getUrlRender - recentComments <- runDB $ selectList [CommentOrigin ==. mediumId] [Desc CommentTime, LimitTo 10] + recentComments <- runDB $ selectList [CommentOrigin ==. mediumId] [Desc CommentTime, LimitTo 100] renderFeed Parameters { pTitle = "Eidolon :: Newest comments on " `T.append` (mediumTitle medium) , pLink = MediumR mediumId , pImage = url $ StaticR $ mediumStaticThumbRoute medium } (Left recentComments) + +getUserFeedAtomR :: UserId -> Handler RepAtom +getUserFeedAtomR = getUserFeedR + +getUserFeedRssR :: UserId -> Handler RepRss +getUserFeedRssR = getUserFeedR + +getUserFeedR :: RepFeed a => UserId -> Handler a +getUserFeedR userId = do + user <- runDB $ get404 userId + recentMedia <- runDB $ selectList [MediumOwner ==. userId] [Desc MediumTime, LimitTo 100] + renderFeed Parameters + { pTitle = "Eidolon :: Newest media of " `T.append` (userSlug user) + , pLink = ProfileR userId + , pImage = "" + } (Right recentMedia) diff --git a/config/routes b/config/routes index 77b3983..c46e6f4 100644 --- a/config/routes +++ b/config/routes @@ -46,3 +46,5 @@ /feed/album/#AlbumId/rss.xml AlbumFeedRssR GET /feed/medium/#MediumId/atom.xml CommentFeedAtomR GET /feed/medium/#MediumId/rss.xml CommentFeedRssR GET +/feed/user/#UserId/atom.xml UserFeedAtomR GET +/feed/user/#UserId/rss.xml UserFeedRssR GET diff --git a/templates/profile.hamlet b/templates/profile.hamlet index d9082bc..670bebb 100644 --- a/templates/profile.hamlet +++ b/templates/profile.hamlet @@ -43,3 +43,7 @@ $else
#{mediumTitle medium} + +get a feed from this: + Atom + RSS