X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2FWebInterface.java;h=ea1cb8330886f2b727894e21da5c6789c360d5fa;hb=2e03e9dddbea4b81aacaf1aa316f5c3ccffd4bf9;hp=593193c0ddffb204cb967cf333ee463e7fed6595;hpb=60fda3f6fd8cd72151338c831f509dd8d9d0f9ff;p=Sone.git diff --git a/src/main/java/net/pterodactylus/sone/web/WebInterface.java b/src/main/java/net/pterodactylus/sone/web/WebInterface.java index 593193c..ea1cb83 100644 --- a/src/main/java/net/pterodactylus/sone/web/WebInterface.java +++ b/src/main/java/net/pterodactylus/sone/web/WebInterface.java @@ -150,11 +150,6 @@ import net.pterodactylus.util.web.RedirectPage; import net.pterodactylus.util.web.StaticPage; import net.pterodactylus.util.web.TemplatePage; -import com.google.common.collect.Collections2; -import com.google.common.collect.ImmutableSet; -import com.google.common.eventbus.Subscribe; -import com.google.inject.Inject; - import freenet.clients.http.SessionManager; import freenet.clients.http.SessionManager.Session; import freenet.clients.http.ToadletContainer; @@ -162,6 +157,11 @@ import freenet.clients.http.ToadletContext; import freenet.l10n.BaseL10n; import freenet.support.api.HTTPRequest; +import com.google.common.collect.Collections2; +import com.google.common.collect.ImmutableSet; +import com.google.common.eventbus.Subscribe; +import com.google.inject.Inject; + /** * Bundles functionality that a web interface of a Freenet plugin needs, e.g. * references to l10n helpers. @@ -246,7 +246,7 @@ public class WebInterface { public WebInterface(SonePlugin sonePlugin) { this.sonePlugin = sonePlugin; formPassword = sonePlugin.pluginRespirator().getToadletContainer().getFormPassword(); - soneTextParser = new SoneTextParser(getCore(), getCore()); + soneTextParser = new SoneTextParser(getCore().getDatabase()); templateContextFactory = new TemplateContextFactory(); templateContextFactory.addAccessor(Object.class, new ReflectionAccessor()); @@ -423,7 +423,7 @@ public class WebInterface { if (soneId == null) { return null; } - return getCore().getLocalSone(soneId, false); + return getCore().getLocalSone(soneId).orNull(); } /** @@ -862,7 +862,7 @@ public class WebInterface { notificationManager.addNotification(mentionNotification); } } else { - getCore().markReplyKnown(reply); + reply.modify().setKnown().update(getCore().postReplyUpdated()); } } @@ -940,7 +940,7 @@ public class WebInterface { localReplyNotification.remove(reply); if (!getMentionedSones(reply.getText()).isEmpty() && reply.getPost().isPresent()) { boolean isMentioned = false; - for (PostReply existingReply : getCore().getReplies(reply.getPostId())) { + for (PostReply existingReply : reply.getPost().transform(Post.TO_REPLIES).get()) { isMentioned |= !reply.isKnown() && !getMentionedSones(existingReply.getText()).isEmpty(); } if (!isMentioned) {