diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2017-12-13 20:21:00 +0100 |
---|---|---|
committer | Julius Härtl <jus@bitgrid.net> | 2017-12-19 18:49:26 +0100 |
commit | a4ca92f29a24de2868c7149c2cff8550bc0ca55e (patch) | |
tree | f4c423bd022417c1e034e5b30caffa92f67b29f4 /lib/private/Avatar.php | |
parent | 6371b765984a8dc9201f37ca89ce2dcf5d6fb78c (diff) | |
download | nextcloud-server-a4ca92f29a24de2868c7149c2cff8550bc0ca55e.tar.gz nextcloud-server-a4ca92f29a24de2868c7149c2cff8550bc0ca55e.zip |
Remove generated avatar on displayname change
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'lib/private/Avatar.php')
-rw-r--r-- | lib/private/Avatar.php | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/private/Avatar.php b/lib/private/Avatar.php index 5893daa1804..3b1aac4b514 100644 --- a/lib/private/Avatar.php +++ b/lib/private/Avatar.php @@ -393,4 +393,18 @@ class Avatar implements IAvatar { return array(round($r * 255), round($g * 255), round($b * 255)); } + public function userChanged($feature, $oldValue, $newValue) { + // We only change the avatar on display name changes + if ($feature !== 'displayName') { + return; + } + + // If the avatar is not generated (so an uploaded image) we skip this + if (!$this->folder->fileExists('generated')) { + return; + } + + $this->remove(); + } + } |