Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Make sure we dont fail with an exception
Signed-off-by: Joas Schilling <[email protected]>
  • Loading branch information
nickvergessen authored and rullzer committed Dec 10, 2019
commit 0a256573c0fe261ed25bb4a46787f55adcad3a46
11 changes: 8 additions & 3 deletions lib/Controller/EndpointController.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,15 @@ public function deleteNotification(int $id): DataResponse {
return new DataResponse(null, Http::STATUS_NOT_FOUND);
}

$deleted = $this->handler->deleteById($id, $this->getCurrentUser());
if ($deleted) {
$this->push->pushDeleteToDevice($this->getCurrentUser(), $id);
try {
$deleted = $this->handler->deleteById($id, $this->getCurrentUser());

if ($deleted) {
$this->push->pushDeleteToDevice($this->getCurrentUser(), $id);
}
} catch (NotificationNotFoundException $e) {
}

return new DataResponse();
}

Expand Down
1 change: 1 addition & 0 deletions lib/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ public function deleteByUser(string $user): bool {
* @param string $user
* @param INotification|null $notification
* @return bool
* @throws NotificationNotFoundException
*/
public function deleteById(int $id, string $user, ?INotification $notification = null): bool {
if (!$notification instanceof INotification) {
Expand Down