Let POST user leave be used from anywhere

This commit is contained in:
Colin McDonald 2016-05-10 18:44:12 -04:00
parent b4b70bafd5
commit 46eda73347

View File

@ -14,18 +14,12 @@ public class POSTUserLeave implements Route {
@Override
public Object handle(Request req, Response res) throws Exception {
User user = User.byId(req.params("id"));
Actor actor = req.attribute("actor");
if (actor.getType() != ActorType.SERVER) {
return ErrorUtils.serverOnly();
}
if (user == null) {
return ErrorUtils.notFound("User", req.params("id"));
}
user.leftServer();
APIv3.getDatastore().save(user);
return user;
}