Skip to content

Commit f28b2c7

Browse files
committed
IBX-9060: Improved form validation and error handling in notification deletion flow.
1 parent cab454a commit f28b2c7

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

src/bundle/Controller/NotificationController.php

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -272,19 +272,26 @@ public function deleteNotificationsAction(Request $request): Response
272272
return $this->redirectToRoute('ibexa.notifications.render.all');
273273
}
274274

275-
$result = $this->submitHandler->handle($form, [$this, 'processDeleteNotifications']);
275+
if ($form->isValid()) {
276+
$result = $this->submitHandler->handle(
277+
$form,
278+
function (NotificationSelectionData $data) {
279+
return $this->processDeleteNotifications($data);
280+
}
281+
);
276282

277-
if ($result instanceof Response) {
278-
return $result;
283+
if ($result instanceof Response) {
284+
return $result;
285+
}
286+
} else {
287+
$this->notificationHandler->error(
288+
/** @Desc("An unexpected error occurred while deleting notifications.") */
289+
'error.unexpected_delete_notifications',
290+
[],
291+
'ibexa_notifications'
292+
);
279293
}
280294

281-
$this->notificationHandler->error(
282-
/** @Desc("An unexpected error occurred while deleting notifications.") */
283-
'error.unexpected_delete_notifications',
284-
[],
285-
'ibexa_notifications'
286-
);
287-
288295
return $this->redirectToRoute('ibexa.notifications.render.all');
289296
}
290297

0 commit comments

Comments
 (0)