Uh oh!
There was an error while loading. Please reload this page.
Remove avatar on user deletion - #6668
Conversation
| $avatar = $manager->getAvatar($user->getUID()); | ||
| $avatar->remove(); | ||
| } catch (\Exception $e) { | ||
| // Ignore exceptions |
There was a problem hiding this comment.
IMO would still make sense to log this, even if it's just level debug or info but if this code ever triggers errors nobody would notice and it makes this feature useless.
There was a problem hiding this comment.
We still kind of ignore it. We just also log it :P
Codecov Report
@@ Coverage Diff @@## master #6668 +/- ##
============================================
- Coverage 52.66% 51.09% -1.57% - Complexity 23542 24865 +1323
============================================
Files 1439 1596 +157 Lines 80218 94608 +14390 Branches 0 1367 +1367 ============================================
+ Hits 42246 48339 +6093 - Misses 37972 46269 +8297
|
| $dispatcher = $this->getEventDispatcher(); | ||
| // Delete avatar on user deletion | ||
| $dispatcher->addListener('OCP\IUser::preDelete', function(GenericEvent $e) { |
There was a problem hiding this comment.
Server container is not the proper place to put place this imho. Rather the AvatarManager.
There was a problem hiding this comment.
I can't put it in the avatarmanager as that is only called once we need the avatarmanager.
Like if you delete a user via the provisioning API. The avatarManager is never initialised. And as such there is nothing listening in there as well.
There was a problem hiding this comment.
ah, rights, that's why all the other listeners are registered in base.php :)
There was a problem hiding this comment.
FYI: a service provider, as the Laravel framework calls them, would be nice in this case.
There was a problem hiding this comment.
Yes :P But a bit out of scope. I moved it for this to the server as base.php is a long huge list of code and functions. IMO this has more of a place in Server.php to link everything together than in base.php
There was a problem hiding this comment.
Yes :P But a bit out of scope
I know. But well, maybe you feel highly motivated during a late night hacking session at the hackweek and want to integrate that :P
blizzz
commented
Nov 3, 2017
tests are failing |
MorrisJobke
commented
Nov 9, 2017
@rullzer Ping |
rullzer
commented
Nov 27, 2017
@icewind1991 the errors happen in |
MorrisJobke
commented
Dec 8, 2017
🏓 |
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
MorrisJobke
commented
Dec 11, 2017
@icewind1991 Still failing: |
Signed-off-by: Robin Appelman <robin@icewind.nl>
icewind1991
commented
Dec 11, 2017
all fixed |
Fixes#6621
Basically I added a new event to the event dispatcher:
OCP\IUser::preDeleteAnd then connected this to remove the avatar.