diff options
author | Shinryuken <watertext@hotmail.it> | 2017-11-07 19:15:02 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-07 19:15:02 +0100 |
commit | 0801b279a4fe91c8cb1d653676f43dfe6c26a6f2 (patch) | |
tree | 5c73a1665d9ac4d24d17529a0000462bff4593d1 /src/org/traccar/notification/NotificationFormatter.java | |
parent | 5117b2e64781161c9e06f57cbee217f174d5731e (diff) | |
download | trackermap-server-0801b279a4fe91c8cb1d653676f43dfe6c26a6f2.tar.gz trackermap-server-0801b279a4fe91c8cb1d653676f43dfe6c26a6f2.tar.bz2 trackermap-server-0801b279a4fe91c8cb1d653676f43dfe6c26a6f2.zip |
User defaults when no User is available - EventForwarder refactoring
Diffstat (limited to 'src/org/traccar/notification/NotificationFormatter.java')
-rw-r--r-- | src/org/traccar/notification/NotificationFormatter.java | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/org/traccar/notification/NotificationFormatter.java b/src/org/traccar/notification/NotificationFormatter.java index 591f848d4..bd919cce0 100644 --- a/src/org/traccar/notification/NotificationFormatter.java +++ b/src/org/traccar/notification/NotificationFormatter.java @@ -39,16 +39,16 @@ public final class NotificationFormatter { private NotificationFormatter() { } - public static VelocityContext prepareContext(Long userIdreq, Event event, Position position) { - - long userId = userIdreq != null ? userIdreq : (Long) Context.getPermissionsManager() - .getDeviceUsers(event.getDeviceId()).toArray()[0]; + public static VelocityContext prepareContext(Long userId, Event event, Position position) { User user = Context.getPermissionsManager().getUser(userId); Device device = Context.getIdentityManager().getById(event.getDeviceId()); VelocityContext velocityContext = new VelocityContext(); - velocityContext.put("user", user); + + if (user != null) { + velocityContext.put("user", user); + } velocityContext.put("device", device); velocityContext.put("event", event); if (position != null) { |