From 09731053c292dfdbd9f53a9b9976fa9202ddd0f9 Mon Sep 17 00:00:00 2001 From: Danielle McLean Date: Tue, 10 Oct 2017 22:41:49 +1100 Subject: [PATCH] Support non-fa site icons by giving sites an actual name separate from their icon class --- config/models | 1 + src/Widget/Card.hs | 2 +- src/Widget/Entry.hs | 2 +- templates/mf2/h-card.hamlet | 2 +- templates/mf2/h-entry.hamlet | 2 +- 5 files changed, 5 insertions(+), 4 deletions(-) diff --git a/config/models b/config/models index 6998622..c4bcbb1 100644 --- a/config/models +++ b/config/models @@ -15,6 +15,7 @@ PgpKey UniqueFingerprint fingerprint Site + name Text sqltype=varchar(255) icon Text sqltype=varchar(255) template Text sqltype=varchar(255) diff --git a/src/Widget/Card.hs b/src/Widget/Card.hs index e919528..4e64b1b 100644 --- a/src/Widget/Card.hs +++ b/src/Widget/Card.hs @@ -16,7 +16,7 @@ arrangeProfiles :: [Profile] -> M.Map (Key Site) (Site, Template) -> [((Site, Te arrangeProfiles profiles sites = sortBy icon $ zip profileSites profiles where findSite = fromJust . flip M.lookup sites . profileSiteId profileSites = findSite <$> profiles - icon = comparing $ siteIcon . fst . fst + icon = comparing $ siteName . fst . fst prettyPgp :: PgpKey -> Text prettyPgp = T.unwords . T.chunksOf 4 . pgpKeyFingerprint diff --git a/src/Widget/Entry.hs b/src/Widget/Entry.hs index a67a527..a2e85ee 100644 --- a/src/Widget/Entry.hs +++ b/src/Widget/Entry.hs @@ -31,7 +31,7 @@ hEntry (Entity entryId entry) = 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] + E.orderBy [E.asc $ site ^. SiteName] return (syndication ^. SyndicationUrl, site ^. SiteIcon, E.coalesceDefault [profile ^. ProfileDisplayName] (profile ^. ProfileUsername)) maybeAuthor <- handlerToWidget . runDB . get . entryAuthorId $ entry $(widgetFile "mf2/h-entry") diff --git a/templates/mf2/h-card.hamlet b/templates/mf2/h-card.hamlet index bb22f25..316d20b 100644 --- a/templates/mf2/h-card.hamlet +++ b/templates/mf2/h-card.hamlet @@ -21,7 +21,7 @@ $forall ((site, template), profile) <- userProfiles
  • - + $maybe name <- profileDisplayName profile #{name} $nothing diff --git a/templates/mf2/h-entry.hamlet b/templates/mf2/h-entry.hamlet index e8cd937..7089b36 100644 --- a/templates/mf2/h-entry.hamlet +++ b/templates/mf2/h-entry.hamlet @@ -19,5 +19,5 @@ #{timeFriendly updated} $forall (E.Value url, E.Value icon, E.Value name) <- posses - + #{name}