Skip to content

Commit

Permalink
implement new notifyDelete() method called from nc core notification …
Browse files Browse the repository at this point in the history
…code. part of changes to allow notifications via unified push app. Signed-off-by: Gavin Element <[email protected]>
  • Loading branch information
gavine99 committed Sep 5, 2024
1 parent 498615b commit df46667
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions lib/App.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ public function notify(INotification $notification): void {
}
}

public function notifyDelete(string $user, ?int $id, ?INotification $notification): void {
$idAsArray = ($id !== null) ? [ $id ] : null;
$appName = ($notification !== null) ? $notification->getApp() : "";
$this->push->pushDeleteToDevice($user, $idAsArray, $appName);
}

public function getLastInsertedId(): ?int {
return $this->lastInsertedId;
}
Expand Down
4 changes: 2 additions & 2 deletions lib/Controller/EndpointController.php
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ public function deleteNotification(int $id): DataResponse {
$deleted = $this->handler->deleteById($id, $this->getCurrentUser(), $notification);

if ($deleted) {
$this->push->pushDeleteToDevice($this->getCurrentUser(), [$id], $notification->getApp());
$this->manager->notifyDelete($this->getCurrentUser(), $id, $notification);
}
} catch (NotificationNotFoundException $e) {
}
Expand All @@ -255,7 +255,7 @@ public function deleteAllNotifications(): DataResponse {

$deletedSomething = $this->handler->deleteByUser($this->getCurrentUser());
if ($deletedSomething) {
$this->push->pushDeleteToDevice($this->getCurrentUser(), null);
$this->manager->notifyDelete($this->getCurrentUser(), null, null);
}

if ($shouldFlush) {
Expand Down

0 comments on commit df46667

Please sign in to comment.