Skip to content

Commit

Permalink
Properly clear cached avatars
Browse files Browse the repository at this point in the history
Signed-off-by: jld3103 <jld3103yt@gmail.com>
  • Loading branch information
provokateurin committed May 9, 2023
1 parent f734a76 commit 2c1bc43
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions lib/private/Avatar/AvatarManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,13 +160,8 @@ public function getAvatar(string $userId) : IAvatar {
public function clearCachedAvatars() {
$users = $this->config->getUsersForUserValue('avatar', 'generated', 'true');
foreach ($users as $userId) {
try {
$folder = $this->appData->getFolder($userId);
$folder->delete();
} catch (NotFoundException $e) {
$this->logger->debug("No cache for the user $userId. Ignoring...");
}
$this->config->setUserValue($userId, 'avatar', 'generated', 'false');
// This also bumps the avatar version leading to cache invalidation in browsers
$this->getAvatar($userId)->remove();
}
}

Expand Down

0 comments on commit 2c1bc43

Please sign in to comment.