From e90bdcedb28995a93429b0276fcc5c1475ca52aa Mon Sep 17 00:00:00 2001 From: Massimiliano Assante Date: Mon, 9 May 2022 12:27:51 +0200 Subject: [PATCH] fix --- .../networking/ws/methods/v2/Notifications.java | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/src/main/java/org/gcube/portal/social/networking/ws/methods/v2/Notifications.java b/src/main/java/org/gcube/portal/social/networking/ws/methods/v2/Notifications.java index 5e192b8..c22a2da 100644 --- a/src/main/java/org/gcube/portal/social/networking/ws/methods/v2/Notifications.java +++ b/src/main/java/org/gcube/portal/social/networking/ws/methods/v2/Notifications.java @@ -230,26 +230,21 @@ public class Notifications { username2Notify = um.getUserByUsername(userIdToNotify).getUsername(); } catch (Exception e) { - status = Status.NOT_ACCEPTABLE; + status = Status.BAD_REQUEST; logger.error("Username not found", e); responseBean.setSuccess(false); - responseBean.setMessage("Username not found " + userIdToNotify); + responseBean.setMessage("Username not found, got: " + userIdToNotify); return Response.status(status).entity(responseBean).build(); } - if (username2Notify != null) { - deliveryResult = + + deliveryResult = nm.notifyCatalogueEvent( CatalogueEventTypeMapper.getType(event.getType()), - username, + username2Notify, event.getItemId(), event.getNotifyText(), event.getItemURL()); - } else { - status = Status.NOT_ACCEPTABLE; - responseBean.setSuccess(false); - responseBean.setMessage("Username not found " + userIdToNotify); - return Response.status(status).entity(responseBean).build(); - } + } } else { //the ids are contexts for (int i = 0; i < idsToNotify.length; i++) {