From 5a5a0e43d3b123780775f723c1c35a417a4e8265 Mon Sep 17 00:00:00 2001 From: meysamrt <46737899+MeysamRT76@users.noreply.github.com> Date: Sun, 18 Feb 2024 16:44:28 +0330 Subject: Refactor: Remove duplicated code in get function (ServerResource.java) Eliminate duplicated code in get function to enhance maintainability and readability. --- src/main/java/org/traccar/api/resource/ServerResource.java | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/main/java/org/traccar/api/resource/ServerResource.java b/src/main/java/org/traccar/api/resource/ServerResource.java index 66ecc74e1..76c8e14c7 100644 --- a/src/main/java/org/traccar/api/resource/ServerResource.java +++ b/src/main/java/org/traccar/api/resource/ServerResource.java @@ -93,15 +93,10 @@ public class ServerResource extends BaseResource { server.setOpenIdEnabled(openIdProvider != null); server.setOpenIdForce(openIdProvider != null && openIdProvider.getForce()); User user = permissionsService.getUser(getUserId()); - if (user != null) { - if (user.getAdministrator()) { - server.setStorageSpace(Log.getStorageSpace()); - } - } else { - server.setNewServer(UserUtil.isEmpty(storage)); - } if (user != null && user.getAdministrator()) { server.setStorageSpace(Log.getStorageSpace()); + } else { + server.setNewServer(UserUtil.isEmpty(storage)); } return server; } -- cgit v1.2.3