aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/notification
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-06-07 06:48:53 -0700
committerAnton Tananaev <anton@traccar.org>2022-06-07 06:48:53 -0700
commit8eecfdcf5c59f92158a6c339d1622e0e9d67968c (patch)
treef0bd5c9d391549ab7b98f87a86938a1341802a23 /src/main/java/org/traccar/notification
parent669bdccecff50eaca46c815598df092ad0fe143d (diff)
downloadtrackermap-server-8eecfdcf5c59f92158a6c339d1622e0e9d67968c.tar.gz
trackermap-server-8eecfdcf5c59f92158a6c339d1622e0e9d67968c.tar.bz2
trackermap-server-8eecfdcf5c59f92158a6c339d1622e0e9d67968c.zip
Pass user to notificators
Diffstat (limited to 'src/main/java/org/traccar/notification')
-rw-r--r--src/main/java/org/traccar/notification/NotificationFormatter.java9
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()));