added userfeed

This commit is contained in:
nek0 2014-12-19 22:36:15 +01:00
parent 8346c1d32f
commit 038e4a3399
3 changed files with 23 additions and 1 deletions

View file

@ -185,9 +185,25 @@ getCommentFeedR :: RepFeed a => MediumId -> Handler a
getCommentFeedR mediumId = do getCommentFeedR mediumId = do
medium <- runDB $ get404 mediumId medium <- runDB $ get404 mediumId
url <- getUrlRender url <- getUrlRender
recentComments <- runDB $ selectList [CommentOrigin ==. mediumId] [Desc CommentTime, LimitTo 10] recentComments <- runDB $ selectList [CommentOrigin ==. mediumId] [Desc CommentTime, LimitTo 100]
renderFeed Parameters renderFeed Parameters
{ pTitle = "Eidolon :: Newest comments on " `T.append` (mediumTitle medium) { pTitle = "Eidolon :: Newest comments on " `T.append` (mediumTitle medium)
, pLink = MediumR mediumId , pLink = MediumR mediumId
, pImage = url $ StaticR $ mediumStaticThumbRoute medium , pImage = url $ StaticR $ mediumStaticThumbRoute medium
} (Left recentComments) } (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)

View file

@ -46,3 +46,5 @@
/feed/album/#AlbumId/rss.xml AlbumFeedRssR GET /feed/album/#AlbumId/rss.xml AlbumFeedRssR GET
/feed/medium/#MediumId/atom.xml CommentFeedAtomR GET /feed/medium/#MediumId/atom.xml CommentFeedAtomR GET
/feed/medium/#MediumId/rss.xml CommentFeedRssR GET /feed/medium/#MediumId/rss.xml CommentFeedRssR GET
/feed/user/#UserId/atom.xml UserFeedAtomR GET
/feed/user/#UserId/rss.xml UserFeedRssR GET

View file

@ -43,3 +43,7 @@ $else
<figure class="thumbnail"> <figure class="thumbnail">
<img src=#{mediumThumb medium}> <img src=#{mediumThumb medium}>
<figcaption>#{mediumTitle medium} <figcaption>#{mediumTitle medium}
get a feed from this:
<a href=@{UserFeedAtomR ownerId}>Atom
<a href=@{UserFeedRssR ownerId}>RSS