/*
- * Sone - TrustAjaxPage.java - Copyright © 2011–2013 David Roden
+ * Sone - TrustAjaxPage.java - Copyright © 2011–2016 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 javax.annotation.Nonnull;
+
import com.google.common.base.Optional;
import net.pterodactylus.sone.core.Core;
* @see Core#trustSone(Sone, Sone)
* @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
*/
-public class TrustAjaxPage extends JsonPage {
+public class TrustAjaxPage extends LoggedInJsonPage {
/**
* Creates a new “trust Sone” AJAX handler.
/**
* {@inheritDoc}
*/
+ @Nonnull
@Override
- protected JsonReturnObject createJsonObject(FreenetRequest request) {
- Sone currentSone = getCurrentSone(request.getToadletContext(), false);
- if (currentSone == null) {
- return createErrorJsonObject("auth-required");
- }
+ protected JsonReturnObject createJsonObject(@Nonnull Sone currentSone, @Nonnull FreenetRequest request) {
String soneId = request.getHttpRequest().getParam("sone");
Optional<Sone> sone = webInterface.getCore().getSone(soneId);
if (!sone.isPresent()) {