diff options
Diffstat (limited to 'src/main/java/com/juick/www/api/Notifications.java')
-rw-r--r-- | src/main/java/com/juick/www/api/Notifications.java | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/main/java/com/juick/www/api/Notifications.java b/src/main/java/com/juick/www/api/Notifications.java index d00fe4ca..613e6cfc 100644 --- a/src/main/java/com/juick/www/api/Notifications.java +++ b/src/main/java/com/juick/www/api/Notifications.java @@ -63,8 +63,8 @@ public class Notifications { private UserService userService; @Inject private TelegramService telegramService; - @Value("${api_user:juick}") - private String serviceUser; + @Inject + private User serviceUser; private User collectTokens(Integer uid) { User user = userService.getUserByUID(uid).orElse(AnonymousUser.INSTANCE); @@ -90,7 +90,7 @@ public class Notifications { @RequestParam(required = false, defaultValue = "0") int uid, @RequestParam(required = false, defaultValue = "0") int mid, @RequestParam(required = false, defaultValue = "0") int rid) { - if (!(visitor.getName().equals(serviceUser))) { + if (!(visitor.equals(serviceUser))) { throw new HttpForbiddenException(); } if (uid > 0 && mid == 0) { @@ -127,7 +127,7 @@ public class Notifications { public Status doDelete( @Visitor User visitor, @RequestBody List<ExternalToken> list) { - if (!visitor.getName().equals(serviceUser)) { + if (!visitor.equals(serviceUser)) { throw new HttpForbiddenException(); } list.forEach(t -> { @@ -153,7 +153,7 @@ public class Notifications { public Status doDeleteTokens( @Visitor User visitor, @RequestBody List<ExternalToken> list) { - if (!visitor.getName().equals(serviceUser)) { + if (!visitor.equals(serviceUser)) { throw new HttpForbiddenException(); } list.forEach(t -> { |