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

Commit 4b8a839

Browse files
committed
Fix: do not confuse avatars path with static path.
1 parent a1b4e99 commit 4b8a839

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

src/Config.hs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,11 @@ data Config = Config
153153
, _listener :: ListenerConfig
154154
, _monitoring :: Maybe ListenerConfig
155155
, _htmlStatic :: FilePath
156-
, _avatarPath :: FilePath -- avatars are stored in this directory
156+
, _avatarPath :: FilePath -- avatars are stored in this directory:
157+
-- FIXME: i think this is not working. run `git grep
158+
-- \"/avatars\"`, and you will find a few places where
159+
-- Config should be consulted, but a string literal is used
160+
-- instead!
157161
, _cfgCsrfSecret :: CsrfSecret
158162
, _logging :: LogConfig
159163
, _persist :: PersistConfig

src/Frontend/Page/Delegation.hs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,12 @@ instance FormPage PageDelegateVote where
9797
DF.inputHidden "selected-delegate" v
9898
div_ [class_ "delegate-image-select"] $ do
9999
ul_ . for_ options' $ \user -> do
100-
let url = "avatars/" <> uid <> ".png"
101-
uid = user ^. _Id . unAUID . showed
100+
let uid = user ^. _Id . unAUID . showed
102101
unm = user ^. userLogin . unUserLogin
103102
li_ [ class_ "icon-list-button col-3-12"
104103
, id_ $ "page-delegate-vote-uid." <> cs uid
105104
] $ do
106-
img_ [ src_ . U.TopStatic $ fromString url
105+
img_ [ src_ . U.TopAvatar . fromString $ uid <> ".png"
107106
, alt_ $ user ^. userLogin . unUserLogin
108107
]
109108
span_ $ toHtml unm

src/Frontend/Path.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ data Top (r :: AllowedMethod) =
177177
| TopTesting UriPath
178178
| TopSamples
179179
| TopStatic UriPath
180+
| TopAvatar UriPath
180181
deriving Generic
181182

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

193195

194196
-- ** Main

0 commit comments

Comments
 (0)