Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions build/psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2223,6 +2223,11 @@
<code><![CDATA[mixed]]></code>
</LessSpecificImplementedReturnType>
</file>
<file src="lib/private/Notification/Manager.php">
<UndefinedClass>
<code><![CDATA[\OCA\Notifications\App]]></code>
</UndefinedClass>
</file>
<file src="lib/private/Preview/BackgroundCleanupJob.php">
<InvalidReturnStatement>
<code><![CDATA[[]]]></code>
Expand Down
18 changes: 13 additions & 5 deletions lib/private/Notification/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,15 @@ public function __construct(
* @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;
}
}

/**
Expand Down Expand Up @@ -237,7 +245,7 @@ public function defer(): bool {
$alreadyDeferring = $this->deferPushing;
$this->deferPushing = true;

$apps = $this->getApps();
$apps = array_reverse($this->getApps());

foreach ($apps as $app) {
if ($app instanceof IDeferrableApp) {
Expand All @@ -252,7 +260,7 @@ public function defer(): bool {
* @since 20.0.0
*/
public function flush(): void {
$apps = $this->getApps();
$apps = array_reverse($this->getApps());

foreach ($apps as $app) {
if (!$app instanceof IDeferrableApp) {
Expand Down Expand Up @@ -384,7 +392,7 @@ public function prepare(INotification $notification, string $languageCode): INot
* @param INotification $notification
*/
public function markProcessed(INotification $notification): void {
$apps = $this->getApps();
$apps = array_reverse($this->getApps());

foreach ($apps as $app) {
$app->markProcessed($notification);
Expand All @@ -396,7 +404,7 @@ public function markProcessed(INotification $notification): void {
* @return int
*/
public function getCount(INotification $notification): int {
$apps = $this->getApps();
$apps = array_reverse($this->getApps());

$count = 0;
foreach ($apps as $app) {
Expand Down
Loading