From 540d77dbd88133a950ebf240f35557aaf98e272e Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Thu, 7 Apr 2011 21:18:47 +0200 Subject: [PATCH] =?utf8?q?Don=E2=80=99t=20mark=20elements=20as=20known=20a?= =?utf8?q?utomatically=20when=20viewing=20a=20page.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This resolves #32. --- src/main/java/net/pterodactylus/sone/web/IndexPage.java | 10 ---------- src/main/java/net/pterodactylus/sone/web/KnownSonesPage.java | 5 ----- src/main/java/net/pterodactylus/sone/web/SearchPage.java | 11 ----------- src/main/java/net/pterodactylus/sone/web/ViewPostPage.java | 5 ----- src/main/java/net/pterodactylus/sone/web/ViewSonePage.java | 12 ------------ 5 files changed, 43 deletions(-) diff --git a/src/main/java/net/pterodactylus/sone/web/IndexPage.java b/src/main/java/net/pterodactylus/sone/web/IndexPage.java index 5f4a4a4..ad59f30 100644 --- a/src/main/java/net/pterodactylus/sone/web/IndexPage.java +++ b/src/main/java/net/pterodactylus/sone/web/IndexPage.java @@ -22,7 +22,6 @@ import java.util.Collections; import java.util.List; import net.pterodactylus.sone.data.Post; -import net.pterodactylus.sone.data.Reply; import net.pterodactylus.sone.data.Sone; import net.pterodactylus.util.collection.Pagination; import net.pterodactylus.util.filter.Filters; @@ -79,15 +78,6 @@ public class IndexPage extends SoneTemplatePage { Pagination pagination = new Pagination(allPosts, 25).setPage(Numbers.safeParseInteger(request.getHttpRequest().getParam("page"), 0)); templateContext.set("pagination", pagination); templateContext.set("posts", pagination.getItems()); - - /* mark it all as known. */ - for (Post post : pagination.getItems()) { - webInterface.getCore().markPostKnown(post); - for (Reply reply : webInterface.getCore().getReplies(post)) { - webInterface.getCore().markReplyKnown(reply); - } - } - } } diff --git a/src/main/java/net/pterodactylus/sone/web/KnownSonesPage.java b/src/main/java/net/pterodactylus/sone/web/KnownSonesPage.java index 6b1b4e3..7c8f9ad 100644 --- a/src/main/java/net/pterodactylus/sone/web/KnownSonesPage.java +++ b/src/main/java/net/pterodactylus/sone/web/KnownSonesPage.java @@ -62,11 +62,6 @@ public class KnownSonesPage extends SoneTemplatePage { Pagination sonePagination = new Pagination(knownSones, 25).setPage(Numbers.safeParseInteger(request.getHttpRequest().getParam("page"), 0)); templateContext.set("pagination", sonePagination); templateContext.set("knownSones", sonePagination.getItems()); - - /* mark Sones as known. */ - for (Sone sone : sonePagination.getItems()) { - webInterface.getCore().markSoneKnown(sone); - } } } diff --git a/src/main/java/net/pterodactylus/sone/web/SearchPage.java b/src/main/java/net/pterodactylus/sone/web/SearchPage.java index cf79b4d..7381f80 100644 --- a/src/main/java/net/pterodactylus/sone/web/SearchPage.java +++ b/src/main/java/net/pterodactylus/sone/web/SearchPage.java @@ -110,17 +110,6 @@ public class SearchPage extends SoneTemplatePage { templateContext.set("soneHits", sonePagination.getItems()); templateContext.set("postPagination", postPagination); templateContext.set("postHits", postPagination.getItems()); - - /* mark found posts and Sones as knew. */ - for (Sone sone : sonePagination.getItems()) { - webInterface.getCore().markSoneKnown(sone); - } - for (Post post : postPagination.getItems()) { - webInterface.getCore().markPostKnown(post); - for (Reply reply : webInterface.getCore().getReplies(post)) { - webInterface.getCore().markReplyKnown(reply); - } - } } // diff --git a/src/main/java/net/pterodactylus/sone/web/ViewPostPage.java b/src/main/java/net/pterodactylus/sone/web/ViewPostPage.java index fe63b34..b62e19c 100644 --- a/src/main/java/net/pterodactylus/sone/web/ViewPostPage.java +++ b/src/main/java/net/pterodactylus/sone/web/ViewPostPage.java @@ -18,7 +18,6 @@ package net.pterodactylus.sone.web; import net.pterodactylus.sone.data.Post; -import net.pterodactylus.sone.data.Reply; import net.pterodactylus.sone.template.SoneAccessor; import net.pterodactylus.util.template.Template; import net.pterodactylus.util.template.TemplateContext; @@ -73,10 +72,6 @@ public class ViewPostPage extends SoneTemplatePage { Post post = webInterface.getCore().getPost(postId); templateContext.set("post", post); templateContext.set("raw", raw); - webInterface.getCore().markPostKnown(post); - for (Reply reply : webInterface.getCore().getReplies(post)) { - webInterface.getCore().markReplyKnown(reply); - } } } diff --git a/src/main/java/net/pterodactylus/sone/web/ViewSonePage.java b/src/main/java/net/pterodactylus/sone/web/ViewSonePage.java index 82284d5..53702f7 100644 --- a/src/main/java/net/pterodactylus/sone/web/ViewSonePage.java +++ b/src/main/java/net/pterodactylus/sone/web/ViewSonePage.java @@ -29,7 +29,6 @@ import net.pterodactylus.sone.data.Post; import net.pterodactylus.sone.data.Reply; import net.pterodactylus.sone.data.Sone; import net.pterodactylus.sone.template.SoneAccessor; -import net.pterodactylus.util.collection.ListBuilder; import net.pterodactylus.util.collection.Pagination; import net.pterodactylus.util.number.Numbers; import net.pterodactylus.util.template.Template; @@ -109,17 +108,6 @@ public class ViewSonePage extends SoneTemplatePage { Pagination repliedPostPagination = new Pagination(posts, 10).setPage(Numbers.safeParseInteger(request.getHttpRequest().getParam("repliedPostPage"), 0)); templateContext.set("repliedPostPagination", repliedPostPagination); templateContext.set("repliedPosts", repliedPostPagination.getItems()); - - /* mark Sone and posts and replies as known. */ - webInterface.getCore().markSoneKnown(sone); - for (Post post : new ListBuilder().addAll(postPagination.getItems()).addAll(repliedPostPagination.getItems()).get()) { - if (post.getSone() != null) { - webInterface.getCore().markPostKnown(post); - } - for (Reply reply : webInterface.getCore().getReplies(post)) { - webInterface.getCore().markReplyKnown(reply); - } - } } } -- 2.7.4