From 17655cdf1b409521262d5d54eb19884d307c47ce Mon Sep 17 00:00:00 2001 From: Morgan Bazalgette Date: Sat, 3 Feb 2018 23:37:05 +0100 Subject: Enable caching on assets and avatars (#3376) * Enable caching on assets and avatars Fixes #3323 * Only set avatar in user BeforeUpdate when there is no avatar set * add error checking after stat * gofmt * Change cache time for avatars to an hour --- models/user.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'models/user.go') diff --git a/models/user.go b/models/user.go index bf28683285..ecfe3bca0f 100644 --- a/models/user.go +++ b/models/user.go @@ -145,7 +145,7 @@ func (u *User) BeforeUpdate() { if len(u.AvatarEmail) == 0 { u.AvatarEmail = u.Email } - if len(u.AvatarEmail) > 0 { + if len(u.AvatarEmail) > 0 && u.Avatar == "" { u.Avatar = base.HashEmail(u.AvatarEmail) } } -- cgit v1.2.3