From 14136295b7568c6e34504c101eba0ee10f5c74fd Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Mon, 29 Aug 2016 14:55:23 +0200 Subject: Cache avatars properly * Set proper caching headers for avatars (15 minutes) * For our own avatar use some extra logic to invalidate when we update --- settings/js/personal.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'settings/js') 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 -- cgit v1.2.3