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++) {