Only trigger postDelete hooks when the user was deleted...
Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
parent
f6ff60f4cb
commit
4d1acfd4ef
|
@ -218,10 +218,10 @@ class User implements IUser {
|
||||||
$notification = \OC::$server->getNotificationManager()->createNotification();
|
$notification = \OC::$server->getNotificationManager()->createNotification();
|
||||||
$notification->setUser($this->uid);
|
$notification->setUser($this->uid);
|
||||||
\OC::$server->getNotificationManager()->markProcessed($notification);
|
\OC::$server->getNotificationManager()->markProcessed($notification);
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->emitter) {
|
if ($this->emitter) {
|
||||||
$this->emitter->emit('\OC\User', 'postDelete', array($this));
|
$this->emitter->emit('\OC\User', 'postDelete', array($this));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return !($result === false);
|
return !($result === false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -435,16 +435,17 @@ class UserTest extends \Test\TestCase {
|
||||||
|
|
||||||
public function dataDeleteHooks() {
|
public function dataDeleteHooks() {
|
||||||
return [
|
return [
|
||||||
[true],
|
[true, 2],
|
||||||
[false],
|
[false, 1],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dataProvider dataDeleteHooks
|
* @dataProvider dataDeleteHooks
|
||||||
* @param bool $result
|
* @param bool $result
|
||||||
|
* @param int $expectedHooks
|
||||||
*/
|
*/
|
||||||
public function testDeleteHooks($result) {
|
public function testDeleteHooks($result, $expectedHooks) {
|
||||||
$hooksCalled = 0;
|
$hooksCalled = 0;
|
||||||
$test = $this;
|
$test = $this;
|
||||||
|
|
||||||
|
@ -521,7 +522,7 @@ class UserTest extends \Test\TestCase {
|
||||||
$this->restoreService('CommentsManager');
|
$this->restoreService('CommentsManager');
|
||||||
$this->restoreService('NotificationManager');
|
$this->restoreService('NotificationManager');
|
||||||
|
|
||||||
$this->assertEquals(2, $hooksCalled);
|
$this->assertEquals($expectedHooks, $hooksCalled);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetCloudId() {
|
public function testGetCloudId() {
|
||||||
|
|
Loading…
Reference in New Issue