Only trigger postDelete hooks when the user was deleted...
Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
parent
9107573020
commit
6b703e97ce
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -430,16 +430,17 @@ class UserTest 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;
|
||||
|
||||
|
@ -516,7 +517,7 @@ class UserTest extends \Test\TestCase {
|
|||
$this->restoreService('CommentsManager');
|
||||
$this->restoreService('NotificationManager');
|
||||
|
||||
$this->assertEquals(2, $hooksCalled);
|
||||
$this->assertEquals($expectedHooks, $hooksCalled);
|
||||
}
|
||||
|
||||
public function testGetCloudId() {
|
||||
|
|
Loading…
Reference in New Issue