mirror of
https://github.com/nextcloud/server.git
synced 2026-06-11 09:42:09 -04:00
Only trigger postDelete hooks when the user was deleted...
Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
parent
203c5f745e
commit
1d9738006a
2 changed files with 8 additions and 7 deletions
|
|
@ -216,10 +216,10 @@ class User implements IUser {
|
|||
$notification = \OC::$server->getNotificationManager()->createNotification();
|
||||
$notification->setUser($this->uid);
|
||||
\OC::$server->getNotificationManager()->markProcessed($notification);
|
||||
}
|
||||
|
||||
if ($this->emitter) {
|
||||
$this->emitter->emit('\OC\User', 'postDelete', array($this));
|
||||
if ($this->emitter) {
|
||||
$this->emitter->emit('\OC\User', 'postDelete', array($this));
|
||||
}
|
||||
}
|
||||
return !($result === false);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -437,16 +437,17 @@ class User extends \Test\TestCase {
|
|||
|
||||
public function dataDeleteHooks() {
|
||||
return [
|
||||
[true],
|
||||
[false],
|
||||
[true, 2],
|
||||
[false, 1],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider dataDeleteHooks
|
||||
* @param bool $result
|
||||
* @param int $expectedHooks
|
||||
*/
|
||||
public function testDeleteHooks($result) {
|
||||
public function testDeleteHooks($result, $expectedHooks) {
|
||||
$hooksCalled = 0;
|
||||
$test = $this;
|
||||
|
||||
|
|
@ -523,7 +524,7 @@ class User extends \Test\TestCase {
|
|||
$this->restoreService('CommentsManager');
|
||||
$this->restoreService('NotificationManager');
|
||||
|
||||
$this->assertEquals(2, $hooksCalled);
|
||||
$this->assertEquals($expectedHooks, $hooksCalled);
|
||||
}
|
||||
|
||||
public function testGetCloudId() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue