This commit is contained in:
Massimiliano Assante 2022-05-09 12:27:51 +02:00
parent 5fd457f230
commit e90bdcedb2
1 changed files with 6 additions and 11 deletions

View File

@ -230,26 +230,21 @@ public class Notifications {
username2Notify = um.getUserByUsername(userIdToNotify).getUsername(); username2Notify = um.getUserByUsername(userIdToNotify).getUsername();
} }
catch (Exception e) { catch (Exception e) {
status = Status.NOT_ACCEPTABLE; status = Status.BAD_REQUEST;
logger.error("Username not found", e); logger.error("Username not found", e);
responseBean.setSuccess(false); responseBean.setSuccess(false);
responseBean.setMessage("Username not found " + userIdToNotify); responseBean.setMessage("Username not found, got: " + userIdToNotify);
return Response.status(status).entity(responseBean).build(); return Response.status(status).entity(responseBean).build();
} }
if (username2Notify != null) {
deliveryResult = deliveryResult =
nm.notifyCatalogueEvent( nm.notifyCatalogueEvent(
CatalogueEventTypeMapper.getType(event.getType()), CatalogueEventTypeMapper.getType(event.getType()),
username, username2Notify,
event.getItemId(), event.getItemId(),
event.getNotifyText(), event.getNotifyText(),
event.getItemURL()); 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 } else { //the ids are contexts
for (int i = 0; i < idsToNotify.length; i++) { for (int i = 0; i < idsToNotify.length; i++) {