Add support for u-syndication of each entry, tracking where else it's been posted
This commit is contained in:
parent
716769d24e
commit
401c544ef1
4 changed files with 18 additions and 0 deletions
|
@ -5,6 +5,8 @@ module Widget.Entry ( entryR, hEntry ) where
|
|||
|
||||
import Import
|
||||
|
||||
import Database.Esqueleto ( (^.) )
|
||||
import qualified Database.Esqueleto as E
|
||||
import Data.Time.Format ( defaultTimeLocale, formatTime, iso8601DateFormat )
|
||||
import Data.Time.Format.Human ( humanReadableTime )
|
||||
|
||||
|
@ -25,5 +27,11 @@ hEntry :: Entity Entry -> Widget
|
|||
hEntry (Entity entryId entry) = do
|
||||
published <- toFormattedTime . entryPublished $ entry
|
||||
updated <- toFormattedTime . entryUpdated $ entry
|
||||
posses <- handlerToWidget . runDB . E.select . E.from $ \(syndication `E.InnerJoin` profile `E.InnerJoin` site) -> do
|
||||
E.on $ profile ^. ProfileSiteId E.==. site ^. SiteId
|
||||
E.on $ syndication ^. SyndicationProfileId E.==. profile ^. ProfileId
|
||||
E.where_ $ syndication ^. SyndicationEntryId E.==. E.val entryId
|
||||
E.orderBy [E.asc $ site ^. SiteIcon]
|
||||
return (syndication ^. SyndicationUrl, site ^. SiteIcon, E.coalesceDefault [profile ^. ProfileDisplayName] (profile ^. ProfileUsername))
|
||||
maybeAuthor <- handlerToWidget . runDB . get . entryAuthorId $ entry
|
||||
$(widgetFile "mf2/h-entry")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue