/*
- * Sone - UntrustAjaxPage.java - Copyright © 2011–2012 David Roden
+ * Sone - UntrustAjaxPage.java - Copyright © 2011–2013 David Roden
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
package net.pterodactylus.sone.web.ajax;
+import com.google.common.base.Optional;
+
import net.pterodactylus.sone.core.Core;
import net.pterodactylus.sone.data.Sone;
import net.pterodactylus.sone.web.WebInterface;
return createErrorJsonObject("auth-required");
}
String soneId = request.getHttpRequest().getParam("sone");
- Sone sone = webInterface.getCore().getSone(soneId, false);
- if (sone == null) {
+ Optional<Sone> sone = webInterface.getCore().getSone(soneId);
+ if (!sone.isPresent()) {
return createErrorJsonObject("invalid-sone-id");
}
- webInterface.getCore().untrustSone(currentSone, sone);
+ webInterface.getCore().untrustSone(currentSone, sone.get());
return createSuccessJsonObject().put("trustValue", (String) null);
}