Fix a few mistakes we made when passing callback results back up
This commit is contained in:
parent
968ceb1a1d
commit
c1017f9241
|
@ -227,28 +227,34 @@ public final class User {
|
||||||
Grant.findByUser(this, new MongoToVertxCallback<>(grantsFuture));
|
Grant.findByUser(this, new MongoToVertxCallback<>(grantsFuture));
|
||||||
|
|
||||||
CompositeFuture.all(punishmentsFuture, ipIntelFuture, ipBansFuture, grantsFuture).setHandler((result) -> {
|
CompositeFuture.all(punishmentsFuture, ipIntelFuture, ipBansFuture, grantsFuture).setHandler((result) -> {
|
||||||
if (result.succeeded()) {
|
if (result.failed()) {
|
||||||
Iterable<Punishment> punishments = result.result().result(0);
|
|
||||||
IpIntel ipIntel = result.result().result(1);
|
|
||||||
Iterable<IpBan> ipBans = result.result().result(2);
|
|
||||||
Iterable<Grant> 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 {
|
|
||||||
callback.onResult(null, result.cause());
|
callback.onResult(null, result.cause());
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Iterable<Punishment> punishments = result.result().result(0);
|
||||||
|
IpIntel ipIntel = result.result().result(1);
|
||||||
|
Iterable<IpBan> ipBans = result.result().result(2);
|
||||||
|
Iterable<Grant> 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
|
// This is only used to help batch requests to mongo
|
||||||
public void getLoginInfo(Server server, IpIntel ipIntel, Iterable<Punishment> punishments, Iterable<IpBan> ipBans, Iterable<Grant> grants, SingleResultCallback<Map<String, Object>> callback) {
|
public void getLoginInfo(Server server, IpIntel ipIntel, Iterable<Punishment> punishments, Iterable<IpBan> ipBans, Iterable<Grant> grants, SingleResultCallback<Map<String, Object>> callback) {
|
||||||
getAccessInfo(ipIntel, punishments, ipBans, (accessInfo, error) -> {
|
getAccessInfo(ipIntel, punishments, ipBans, (accessInfo, error) -> {
|
||||||
|
if (error != null) {
|
||||||
|
callback.onResult(null, error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ServerGroup serverGroup = ServerGroup.findById(server.getServerGroup());
|
ServerGroup serverGroup = ServerGroup.findById(server.getServerGroup());
|
||||||
Punishment activeMute = null;
|
Punishment activeMute = null;
|
||||||
|
|
||||||
|
|
|
@ -41,6 +41,8 @@ public class POSTUsersIdLeave implements Handler<RoutingContext> {
|
||||||
APIv3.respondJson(ctx, 200, user);
|
APIv3.respondJson(ctx, 200, user);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
APIv3.respondJson(ctx, 200, user);
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue