Add an /avatars/#UserId route which redirects to the user's current avatar every time, so you don't need to update remote references to it
This commit is contained in:
parent
1df217ac01
commit
e69202829a
4 changed files with 15 additions and 1 deletions
|
@ -7,6 +7,7 @@
|
|||
/sitemap.xml SitemapR GET
|
||||
|
||||
/ HomeR GET
|
||||
/avatars/#UserId AvatarR GET
|
||||
/feed FeedR GET
|
||||
!/#EntryKind/feed FeedKindR GET
|
||||
|
||||
|
|
|
@ -48,6 +48,7 @@ import System.Log.FastLogger (defaultBufSize, newStdoutLoggerSet,
|
|||
|
||||
-- Import all relevant handler modules here.
|
||||
-- Don't forget to add new modules to your cabal file!
|
||||
import Handler.Avatars
|
||||
import Handler.Common
|
||||
import Handler.Entries
|
||||
import Handler.Feed
|
||||
|
|
12
src/Handler/Avatars.hs
Normal file
12
src/Handler/Avatars.hs
Normal file
|
@ -0,0 +1,12 @@
|
|||
{-# LANGUAGE NoImplicitPrelude #-}
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
module Handler.Avatars where
|
||||
|
||||
import Import
|
||||
|
||||
import Model.Cache ( getCached )
|
||||
import Settings.StaticR ( staticR )
|
||||
|
||||
getAvatarR :: UserId -> Handler ()
|
||||
getAvatarR = redirect <=< fmap (avatarR . entityVal) . getCached
|
||||
where avatarR user = staticR ["img", userAvatar user]
|
|
@ -2,7 +2,7 @@
|
|||
$maybe route <- mcurrentRoute
|
||||
<a .u-uid.u-url href=@{route} hidden>
|
||||
|
||||
<img .card-img-top.u-photo src=@{staticR ["img", userAvatar user]} alt="Avatar for #{userFullName user}">
|
||||
<img .card-img-top.u-photo src=@{AvatarR userId} alt="Avatar for #{userFullName user}">
|
||||
|
||||
<div .card-body>
|
||||
<h4 .card-title.p-name>#{userFullName user}
|
||||
|
|
Loading…
Reference in a new issue