Skip to content

Commit 7086cc5

Browse files
committed
Refactor OC\Server::getNotificationManager
Signed-off-by: Andrew Summers <18727110+summersab@users.noreply.github.com>
1 parent 613cd16 commit 7086cc5

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

core/Application.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
use OCP\Files\Events\Node\NodeDeletedEvent;
5858
use OCP\Files\Events\Node\NodeWrittenEvent;
5959
use OCP\Files\Events\NodeRemovedFromCache;
60+
use OCP\Notification\IManager as INotificationManager;
6061
use OCP\User\Events\BeforeUserDeletedEvent;
6162
use OCP\User\Events\UserDeletedEvent;
6263
use OCP\Util;
@@ -81,7 +82,7 @@ public function __construct() {
8182
/** @var IEventDispatcher $eventDispatcher */
8283
$eventDispatcher = $server->get(IEventDispatcher::class);
8384

84-
$notificationManager = $server->getNotificationManager();
85+
$notificationManager = $server->get(INotificationManager::class);
8586
$notificationManager->registerNotifierService(CoreNotifier::class);
8687
$notificationManager->registerNotifierService(AuthenticationNotifier::class);
8788

lib/private/Repair.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
use OCP\EventDispatcher\IEventDispatcher;
4343
use OCP\Migration\IOutput;
4444
use OCP\Migration\IRepairStep;
45+
use OCP\Notification\IManager as INotificationManager;
4546
use OC\DB\Connection;
4647
use OC\DB\ConnectionAdapter;
4748
use OC\Repair\AddBruteForceCleanupJob;
@@ -198,7 +199,7 @@ public static function getRepairSteps(): array {
198199
new AddCleanupUpdaterBackupsJob(\OC::$server->getJobList()),
199200
new CleanupCardDAVPhotoCache(\OC::$server->getConfig(), \OC::$server->getAppDataDir('dav-photocache'), \OC::$server->get(LoggerInterface::class)),
200201
new AddClenupLoginFlowV2BackgroundJob(\OC::$server->getJobList()),
201-
new RemoveLinkShares(\OC::$server->getDatabaseConnection(), \OC::$server->getConfig(), \OC::$server->getGroupManager(), \OC::$server->getNotificationManager(), \OCP\Server::get(ITimeFactory::class)),
202+
new RemoveLinkShares(\OC::$server->getDatabaseConnection(), \OC::$server->getConfig(), \OC::$server->getGroupManager(), \OC::$server->get(INotificationManager::class), \OCP\Server::get(ITimeFactory::class)),
202203
new ClearCollectionsAccessCache(\OC::$server->getConfig(), \OCP\Server::get(IManager::class)),
203204
\OCP\Server::get(ResetGeneratedAvatarFlag::class),
204205
\OCP\Server::get(EncryptionLegacyCipher::class),

lib/private/User/User.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
use OCP\IURLGenerator;
5050
use OCP\IUser;
5151
use OCP\IUserBackend;
52+
use OCP\Notification\IManager as INotificationManager;
5253
use OCP\User\Events\BeforePasswordUpdatedEvent;
5354
use OCP\User\Events\BeforeUserDeletedEvent;
5455
use OCP\User\Events\PasswordUpdatedEvent;
@@ -297,9 +298,9 @@ public function delete() {
297298
$avatarManager = \OCP\Server::get(AvatarManager::class);
298299
$avatarManager->deleteUserAvatar($this->uid);
299300

300-
$notification = \OC::$server->getNotificationManager()->createNotification();
301+
$notification = \OC::$server->get(INotificationManager::class)->createNotification();
301302
$notification->setUser($this->uid);
302-
\OC::$server->getNotificationManager()->markProcessed($notification);
303+
\OC::$server->get(INotificationManager::class)->markProcessed($notification);
303304

304305
/** @var AccountManager $accountManager */
305306
$accountManager = \OCP\Server::get(AccountManager::class);

0 commit comments

Comments
 (0)