From 3e3f2555dc759a9c9a5fbeba8c7f2c8be85463ac Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 14 Jan 2023 13:10:43 +0000 Subject: [PATCH] Ensure to reset the avatar paths when deleting avatar cache --- src/Contact/Avatar.php | 7 +++++-- src/Model/Contact.php | 4 +++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/Contact/Avatar.php b/src/Contact/Avatar.php index 7151acbfbd..e039a52799 100644 --- a/src/Contact/Avatar.php +++ b/src/Contact/Avatar.php @@ -246,13 +246,16 @@ class Avatar * Delete locally cached avatar pictures of a contact * * @param string $avatar - * @return void + * @return bool */ - public static function deleteCache(array $contact) + public static function deleteCache(array $contact): bool { + $existed = (self::isCacheFile($contact['photo']) || self::isCacheFile($contact['thumb']) || self::isCacheFile($contact['micro'])); self::deleteCacheFile($contact['photo']); self::deleteCacheFile($contact['thumb']); self::deleteCacheFile($contact['micro']); + + return $existed; } /** diff --git a/src/Model/Contact.php b/src/Model/Contact.php index 931ae3e4dc..e847ce0346 100644 --- a/src/Model/Contact.php +++ b/src/Model/Contact.php @@ -2252,7 +2252,9 @@ class Contact } if (in_array($contact['network'], [Protocol::FEED, Protocol::MAIL]) || $cache_avatar) { - Avatar::deleteCache($contact); + if (Avatar::deleteCache($contact)) { + $force = true; + } if ($default_avatar && Proxy::isLocalImage($avatar)) { $fields = ['avatar' => $avatar, 'avatar-date' => DateTimeFormat::utcNow(),