Merge pull request #40147 from summersab/refactor/OC-Server-getNotificationManager

This commit is contained in:
John Molakvoæ 2024-05-31 19:09:38 +02:00 committed by GitHub
commit 95dc7729fb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 7 additions and 4 deletions

View file

@ -25,6 +25,7 @@ use OCP\AppFramework\Http\Events\BeforeTemplateRenderedEvent;
use OCP\DB\Events\AddMissingIndicesEvent;
use OCP\DB\Events\AddMissingPrimaryKeyEvent;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\Notification\IManager as INotificationManager;
use OCP\User\Events\BeforeUserDeletedEvent;
use OCP\User\Events\UserDeletedEvent;
use OCP\Util;
@ -48,7 +49,7 @@ class Application extends App {
/** @var IEventDispatcher $eventDispatcher */
$eventDispatcher = $server->get(IEventDispatcher::class);
$notificationManager = $server->getNotificationManager();
$notificationManager = $server->get(INotificationManager::class);
$notificationManager->registerNotifierService(CoreNotifier::class);
$notificationManager->registerNotifierService(AuthenticationNotifier::class);

View file

@ -60,6 +60,7 @@ use OCP\Collaboration\Resources\IManager;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\Migration\IOutput;
use OCP\Migration\IRepairStep;
use OCP\Notification\IManager as INotificationManager;
use Psr\Log\LoggerInterface;
use Throwable;
@ -168,7 +169,7 @@ class Repair implements IOutput {
new AddCleanupUpdaterBackupsJob(\OC::$server->getJobList()),
new CleanupCardDAVPhotoCache(\OC::$server->getConfig(), \OC::$server->getAppDataDir('dav-photocache'), \OC::$server->get(LoggerInterface::class)),
new AddClenupLoginFlowV2BackgroundJob(\OC::$server->getJobList()),
new RemoveLinkShares(\OC::$server->getDatabaseConnection(), \OC::$server->getConfig(), \OC::$server->getGroupManager(), \OC::$server->getNotificationManager(), \OCP\Server::get(ITimeFactory::class)),
new RemoveLinkShares(\OC::$server->getDatabaseConnection(), \OC::$server->getConfig(), \OC::$server->getGroupManager(), \OC::$server->get(INotificationManager::class), \OCP\Server::get(ITimeFactory::class)),
new ClearCollectionsAccessCache(\OC::$server->getConfig(), \OCP\Server::get(IManager::class)),
\OCP\Server::get(ResetGeneratedAvatarFlag::class),
\OCP\Server::get(EncryptionLegacyCipher::class),

View file

@ -23,6 +23,7 @@ use OCP\IImage;
use OCP\IURLGenerator;
use OCP\IUser;
use OCP\IUserBackend;
use OCP\Notification\IManager as INotificationManager;
use OCP\User\Backend\IGetHomeBackend;
use OCP\User\Backend\IProvideAvatarBackend;
use OCP\User\Backend\IProvideEnabledStateBackend;
@ -271,9 +272,9 @@ class User implements IUser {
$avatarManager = \OCP\Server::get(AvatarManager::class);
$avatarManager->deleteUserAvatar($this->uid);
$notification = \OC::$server->getNotificationManager()->createNotification();
$notification = \OC::$server->get(INotificationManager::class)->createNotification();
$notification->setUser($this->uid);
\OC::$server->getNotificationManager()->markProcessed($notification);
\OC::$server->get(INotificationManager::class)->markProcessed($notification);
/** @var AccountManager $accountManager */
$accountManager = \OCP\Server::get(AccountManager::class);