diff options
author | Joas Schilling <213943+nickvergessen@users.noreply.github.com> | 2025-04-01 16:52:19 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-04-01 16:52:19 +0200 |
commit | d4b805c88a7128c275ae4352f31c51267beadc35 (patch) | |
tree | 62cdcc7d2f5f0b9f592f1d5defbd4e405fa0616d /lib | |
parent | 15d04b1ef193159f16888fcdbcef37e8297054a5 (diff) | |
parent | ed6d76ec8d60c158f7c0597bdfe1527c9e8bd89e (diff) | |
download | nextcloud-server-d4b805c88a7128c275ae4352f31c51267beadc35.tar.gz nextcloud-server-d4b805c88a7128c275ae4352f31c51267beadc35.zip |
Merge pull request #51800 from gavine99/deterministic-notification-manager
notification manager deterministic app call order
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/Notification/Manager.php | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/lib/private/Notification/Manager.php b/lib/private/Notification/Manager.php index ac287e97048..b75e52deacb 100644 --- a/lib/private/Notification/Manager.php +++ b/lib/private/Notification/Manager.php @@ -74,7 +74,15 @@ class Manager implements IManager { * @since 17.0.0 */ public function registerApp(string $appClass): void { - $this->appClasses[] = $appClass; + // other apps may want to rely on the 'main' notification app so make it deterministic that + // the 'main' notification app adds it's notifications first and removes it's notifications last + if ($appClass === \OCA\Notifications\App::class) { + // add 'main' notifications app to start of internal list of apps + array_unshift($this->appClasses, $appClass); + } else { + // add app to end of internal list of apps + $this->appClasses[] = $appClass; + } } /** @@ -237,7 +245,7 @@ class Manager implements IManager { $alreadyDeferring = $this->deferPushing; $this->deferPushing = true; - $apps = $this->getApps(); + $apps = array_reverse($this->getApps()); foreach ($apps as $app) { if ($app instanceof IDeferrableApp) { @@ -252,7 +260,7 @@ class Manager implements IManager { * @since 20.0.0 */ public function flush(): void { - $apps = $this->getApps(); + $apps = array_reverse($this->getApps()); foreach ($apps as $app) { if (!$app instanceof IDeferrableApp) { @@ -384,7 +392,7 @@ class Manager implements IManager { * @param INotification $notification */ public function markProcessed(INotification $notification): void { - $apps = $this->getApps(); + $apps = array_reverse($this->getApps()); foreach ($apps as $app) { $app->markProcessed($notification); @@ -396,7 +404,7 @@ class Manager implements IManager { * @return int */ public function getCount(INotification $notification): int { - $apps = $this->getApps(); + $apps = array_reverse($this->getApps()); $count = 0; foreach ($apps as $app) { |