diff --git a/src/main/java/net/frozenorb/apiv3/model/User.java b/src/main/java/net/frozenorb/apiv3/model/User.java index ab0dd15..7e9ad00 100644 --- a/src/main/java/net/frozenorb/apiv3/model/User.java +++ b/src/main/java/net/frozenorb/apiv3/model/User.java @@ -227,28 +227,34 @@ public final class User { Grant.findByUser(this, new MongoToVertxCallback<>(grantsFuture)); CompositeFuture.all(punishmentsFuture, ipIntelFuture, ipBansFuture, grantsFuture).setHandler((result) -> { - if (result.succeeded()) { - Iterable punishments = result.result().result(0); - IpIntel ipIntel = result.result().result(1); - Iterable ipBans = result.result().result(2); - Iterable grants = result.result().result(3); - - getLoginInfo(server, ipIntel, punishments, ipBans, grants, (loginInfo, error) -> { - if (error != null) { - callback.onResult(null, error); - } else { - callback.onResult(loginInfo, null); - } - }); - } else { + if (result.failed()) { callback.onResult(null, result.cause()); + return; } + + Iterable punishments = result.result().result(0); + IpIntel ipIntel = result.result().result(1); + Iterable ipBans = result.result().result(2); + Iterable grants = result.result().result(3); + + getLoginInfo(server, ipIntel, punishments, ipBans, grants, (loginInfo, error) -> { + if (error != null) { + callback.onResult(null, error); + } else { + callback.onResult(loginInfo, null); + } + }); }); } // This is only used to help batch requests to mongo public void getLoginInfo(Server server, IpIntel ipIntel, Iterable punishments, Iterable ipBans, Iterable grants, SingleResultCallback> callback) { getAccessInfo(ipIntel, punishments, ipBans, (accessInfo, error) -> { + if (error != null) { + callback.onResult(null, error); + return; + } + ServerGroup serverGroup = ServerGroup.findById(server.getServerGroup()); Punishment activeMute = null; diff --git a/src/main/java/net/frozenorb/apiv3/route/users/POSTUsersIdLeave.java b/src/main/java/net/frozenorb/apiv3/route/users/POSTUsersIdLeave.java index 13c0df3..9bedaf8 100644 --- a/src/main/java/net/frozenorb/apiv3/route/users/POSTUsersIdLeave.java +++ b/src/main/java/net/frozenorb/apiv3/route/users/POSTUsersIdLeave.java @@ -41,6 +41,8 @@ public class POSTUsersIdLeave implements Handler { APIv3.respondJson(ctx, 200, user); } }); + } else { + APIv3.respondJson(ctx, 200, user); } })); }