summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2017-12-16 16:44:47 +0100
committerJulius Härtl <jus@bitgrid.net>2017-12-19 18:49:26 +0100
commit4c3eb80a9102ceaf08d5143eaba8877a8a43e57d (patch)
tree0c9aed8fbd785bc585cfef63c66105b0578238db /lib
parentd497f79625a35330f8a07d9d6913281fa2d0deac (diff)
downloadnextcloud-server-4c3eb80a9102ceaf08d5143eaba8877a8a43e57d.tar.gz
nextcloud-server-4c3eb80a9102ceaf08d5143eaba8877a8a43e57d.zip
Hide delete button if the avatar is a generated one
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Avatar.php3
-rw-r--r--lib/private/Template/JSConfigHelper.php1
2 files changed, 4 insertions, 0 deletions
diff --git a/lib/private/Avatar.php b/lib/private/Avatar.php
index 3b1aac4b514..afa9118c509 100644
--- a/lib/private/Avatar.php
+++ b/lib/private/Avatar.php
@@ -141,6 +141,7 @@ class Avatar implements IAvatar {
try {
$generated = $this->folder->getFile('generated');
+ $this->config->setUserValue($this->user->getUID(), 'avatar', 'generated', 'false');
$generated->delete();
} catch (NotFoundException $e) {
//
@@ -161,6 +162,7 @@ class Avatar implements IAvatar {
foreach ($avatars as $avatar) {
$avatar->delete();
}
+ $this->config->setUserValue($this->user->getUID(), 'avatar', 'generated', 'true');
$this->user->triggerChange('avatar', '');
}
@@ -177,6 +179,7 @@ class Avatar implements IAvatar {
$ext = 'png';
$this->folder->newFile('generated');
+ $this->config->setUserValue($this->user->getUID(), 'avatar', 'generated', 'true');
}
if ($size === -1) {
diff --git a/lib/private/Template/JSConfigHelper.php b/lib/private/Template/JSConfigHelper.php
index 60ac4bfecb0..551fc3b9b0d 100644
--- a/lib/private/Template/JSConfigHelper.php
+++ b/lib/private/Template/JSConfigHelper.php
@@ -254,6 +254,7 @@ class JSConfigHelper {
$array['oc_userconfig'] = json_encode([
'avatar' => [
'version' => (int)$this->config->getUserValue($uid, 'avatar', 'version', 0),
+ 'generated' => $this->config->getUserValue($uid, 'avatar', 'generated', 'true') === 'true',
]
]);
}