diff options
Diffstat (limited to 'src/main/java/org/traccar/notification')
-rw-r--r-- | src/main/java/org/traccar/notification/NotificationFormatter.java | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/main/java/org/traccar/notification/NotificationFormatter.java b/src/main/java/org/traccar/notification/NotificationFormatter.java index 30a862372..c3e37c9e9 100644 --- a/src/main/java/org/traccar/notification/NotificationFormatter.java +++ b/src/main/java/org/traccar/notification/NotificationFormatter.java @@ -33,9 +33,8 @@ public final class NotificationFormatter { } public static NotificationMessage formatMessage( - CacheManager cacheManager, long userId, Event event, Position position, String templatePath) { + CacheManager cacheManager, User user, Event event, Position position, String templatePath) { - User user = cacheManager.getObject(User.class, userId); Device device = cacheManager.getObject(Device.class, event.getDeviceId()); VelocityContext velocityContext = TextTemplateFormatter.prepareContext(user); @@ -44,9 +43,9 @@ public final class NotificationFormatter { velocityContext.put("event", event); if (position != null) { velocityContext.put("position", position); - velocityContext.put("speedUnit", ReportUtils.getSpeedUnit(userId)); - velocityContext.put("distanceUnit", ReportUtils.getDistanceUnit(userId)); - velocityContext.put("volumeUnit", ReportUtils.getVolumeUnit(userId)); + velocityContext.put("speedUnit", ReportUtils.getSpeedUnit(user.getId())); + velocityContext.put("distanceUnit", ReportUtils.getDistanceUnit(user.getId())); + velocityContext.put("volumeUnit", ReportUtils.getVolumeUnit(user.getId())); } if (event.getGeofenceId() != 0) { velocityContext.put("geofence", cacheManager.getObject(Geofence.class, event.getGeofenceId())); |