check the user
This commit is contained in:
parent
d632e3ed1a
commit
70ce721d6b
|
@ -216,7 +216,8 @@ public class Notifications {
|
|||
try {
|
||||
logger.debug("catalogue notifications type is " + event.getType());
|
||||
SocialNetworkingSite site = SocialNetworkingSiteFinder.getSocialNetworkingSiteFromScope(context);
|
||||
GCubeUser senderUser = UserManagerWSBuilder.getInstance().getUserManager().getUserByUsername(username);
|
||||
UserManager um = UserManagerWSBuilder.getInstance().getUserManager();
|
||||
GCubeUser senderUser = um.getUserByUsername(username);
|
||||
SocialNetworkingUser user = new SocialNetworkingUser(senderUser.getUsername(), senderUser.getEmail(), senderUser.getFullname(), senderUser.getUserAvatarURL());
|
||||
NotificationsManager nm = new ApplicationNotificationsManager(UserManagerWSBuilder.getInstance().getUserManager(), site, context, user);
|
||||
|
||||
|
@ -224,6 +225,16 @@ public class Notifications {
|
|||
if (! event.idsAsGroup()) {
|
||||
for (int i = 0; i < idsToNotify.length; i++) {
|
||||
String userIdToNotify = idsToNotify[i];
|
||||
try {
|
||||
um.getUserByUsername(userIdToNotify);
|
||||
}
|
||||
catch (Exception e) {
|
||||
status = Status.NOT_ACCEPTABLE;
|
||||
logger.error("Username not found", e);
|
||||
responseBean.setSuccess(false);
|
||||
responseBean.setMessage("Username not found " + userIdToNotify);
|
||||
return Response.status(status).entity(responseBean).build();
|
||||
}
|
||||
deliveryResult =
|
||||
nm.notifyCatalogueEvent(
|
||||
CatalogueEventTypeMapper.getType(event.getType()),
|
||||
|
|
Loading…
Reference in New Issue