diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2016-08-29 14:55:23 +0200 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2016-08-30 09:00:16 +0200 |
commit | 14136295b7568c6e34504c101eba0ee10f5c74fd (patch) | |
tree | 8fa8c31163b4a4fc8621919f330f22e5631af385 /settings | |
parent | c481210e2b24706f4cb0159bd82eb16ec58d9e92 (diff) | |
download | nextcloud-server-14136295b7568c6e34504c101eba0ee10f5c74fd.tar.gz nextcloud-server-14136295b7568c6e34504c101eba0ee10f5c74fd.zip |
Cache avatars properly
* Set proper caching headers for avatars (15 minutes)
* For our own avatar use some extra logic to invalidate when we update
Diffstat (limited to 'settings')
-rw-r--r-- | settings/js/personal.js | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/settings/js/personal.js b/settings/js/personal.js index 16a8d184da6..e0c99ae774d 100644 --- a/settings/js/personal.js +++ b/settings/js/personal.js @@ -100,6 +100,9 @@ function updateAvatar (hidedefault) { var $headerdiv = $('#header .avatardiv'); var $displaydiv = $('#displayavatar .avatardiv'); + //Bump avatar avatarversion + oc_userconfig.avatar.version = -(Math.floor(Math.random() * 1000)); + if (hidedefault) { $headerdiv.hide(); $('#header .avatardiv').removeClass('avatardiv-shown'); @@ -112,7 +115,10 @@ function updateAvatar (hidedefault) { $displaydiv.avatar(OC.currentUser, 145, true); $.get(OC.generateUrl( '/avatar/{user}/{size}', - {user: OC.currentUser, size: 1} + { + user: OC.currentUser, + size: 1 + } ), function (result) { if (typeof(result) === 'string') { // Show the delete button when the avatar is custom @@ -358,7 +364,10 @@ $(document).ready(function () { // does the user have a custom avatar? if he does show #removeavatar $.get(OC.generateUrl( '/avatar/{user}/{size}', - {user: OC.currentUser, size: 1} + { + user: OC.currentUser, + size: 1 + } ), function (result) { if (typeof(result) === 'string') { // Show the delete button when the avatar is custom |