Skip to content
This repository has been archived by the owner on Feb 2, 2023. It is now read-only.

Commit

Permalink
Fix: do not confuse avatars path with static path.
Browse files Browse the repository at this point in the history
  • Loading branch information
fisx committed Oct 21, 2016
1 parent a1b4e99 commit 4b8a839
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
6 changes: 5 additions & 1 deletion src/Config.hs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,11 @@ data Config = Config
, _listener :: ListenerConfig
, _monitoring :: Maybe ListenerConfig
, _htmlStatic :: FilePath
, _avatarPath :: FilePath -- avatars are stored in this directory
, _avatarPath :: FilePath -- avatars are stored in this directory:
-- FIXME: i think this is not working. run `git grep
-- \"/avatars\"`, and you will find a few places where
-- Config should be consulted, but a string literal is used
-- instead!
, _cfgCsrfSecret :: CsrfSecret
, _logging :: LogConfig
, _persist :: PersistConfig
Expand Down
5 changes: 2 additions & 3 deletions src/Frontend/Page/Delegation.hs
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,12 @@ instance FormPage PageDelegateVote where
DF.inputHidden "selected-delegate" v
div_ [class_ "delegate-image-select"] $ do
ul_ . for_ options' $ \user -> do
let url = "avatars/" <> uid <> ".png"
uid = user ^. _Id . unAUID . showed
let uid = user ^. _Id . unAUID . showed
unm = user ^. userLogin . unUserLogin
li_ [ class_ "icon-list-button col-3-12"
, id_ $ "page-delegate-vote-uid." <> cs uid
] $ do
img_ [ src_ . U.TopStatic $ fromString url
img_ [ src_ . U.TopAvatar . fromString $ uid <> ".png"
, alt_ $ user ^. userLogin . unUserLogin
]
span_ $ toHtml unm
Expand Down
2 changes: 2 additions & 0 deletions src/Frontend/Path.hs
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ data Top (r :: AllowedMethod) =
| TopTesting UriPath
| TopSamples
| TopStatic UriPath
| TopAvatar UriPath
deriving Generic

instance SOP.Generic (Top r)
Expand All @@ -189,6 +190,7 @@ top (TopMain p) = relPath p
top (TopTesting p) = nil </> "testing" <> p
top TopSamples = nil </> "samples"
top (TopStatic p) = nil </> "static" <> p
top (TopAvatar p) = nil </> "avatars" <> p


-- ** Main
Expand Down

0 comments on commit 4b8a839

Please sign in to comment.