Skip to content

Fixed issue where dismissing a notification returns a 500 error#337

Merged
John-Wiens merged 4 commits into
developfrom
Fix/notification-dismissal
Jun 19, 2026
Merged

Fixed issue where dismissing a notification returns a 500 error#337
John-Wiens merged 4 commits into
developfrom
Fix/notification-dismissal

Conversation

@John-Wiens

@John-Wiens John-Wiens commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator

This PR fixes a problem where the notification deletion endpoint is improperly passed to the API endpoint as an improperly encoded request body, this results in a 500 error from the API. This issue can be replicated by trying to dismiss a notification from the intersection page of the CV-Manager GUI. This PR fixes the issue by passing the notification ID as a url parameter instead which simplifies the procedure. Additionally this PR adjusts the return value of the api call in the front end so that it returns whether the notification deletion succeeded or failed properly.

This PR also fixes a minor bug where the default arguments for the getIntersectionsByLocation function are booleans while the values they represent should be doubles. Since these parameters are actually required, the incorrect defaults were removed and the function arguments were marked as required.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes the “dismiss notification” workflow by aligning the frontend DELETE call with the backend endpoint contract (sending the notification key as a URL query parameter rather than a request body) and ensuring the frontend returns the real success/failure result.

Changes:

  • Webapp: send key as a DELETE query parameter and return the computed success value from dismissNotifications.
  • Intersection API: change delete endpoint to accept key via @RequestParam, add basic validation, and normalize the key before deletion.
  • Tests/controllers: formatting-only changes in ActiveNotificationControllerTest and IntersectionController.

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 5 comments.

File Description
webapp/src/apis/intersections/notification-api.ts Updates dismiss call to pass key as a query param and return actual success/failure.
services/intersection-api/api/src/main/java/us/dot/its/jpo/ode/api/controllers/intersections/ActiveNotificationController.java Updates DELETE endpoint to read key from query params, validates/normalizes input.
services/intersection-api/api/src/test/java/us/dot/its/jpo/ode/api/controllers/intersections/ActiveNotificationControllerTest.java Whitespace/formatting changes (plus opportunities for cleanup noted in comments).
services/intersection-api/api/src/main/java/us/dot/its/jpo/ode/api/controllers/intersections/IntersectionController.java Whitespace/formatting changes; uncovered an issue with longitude/latitude default values.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +218 to +220
ResponseStatusException thrown = assertThrows(
ResponseStatusException.class,
() -> controller.deleteActiveNotification(key));
Comment on lines +112 to +118
if (!StringUtils.hasText(key)) {
return ResponseEntity.status(HttpStatus.BAD_REQUEST)
.body("Missing required notification key");
}

String normalizedKey = key.replace("\"", "").trim();
long count = activeNotificationRepo.delete(normalizedKey);

@drewjj drewjj left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Just the one comment but nothing blocking.

@jacob6838 jacob6838 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great to me!

@John-Wiens John-Wiens merged commit c50e217 into develop Jun 19, 2026
13 checks passed
@John-Wiens John-Wiens deleted the Fix/notification-dismissal branch June 19, 2026 19:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants