Don’t mark elements as known automatically when viewing a page.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 7 Apr 2011 19:18:47 +0000 (21:18 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 7 Apr 2011 19:18:47 +0000 (21:18 +0200)
This resolves #32.

src/main/java/net/pterodactylus/sone/web/IndexPage.java
src/main/java/net/pterodactylus/sone/web/KnownSonesPage.java
src/main/java/net/pterodactylus/sone/web/SearchPage.java
src/main/java/net/pterodactylus/sone/web/ViewPostPage.java
src/main/java/net/pterodactylus/sone/web/ViewSonePage.java

index 5f4a4a4..ad59f30 100644 (file)
@@ -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<Post> pagination = new Pagination<Post>(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);
-                       }
-               }
-
        }
 
 }
index 6b1b4e3..7c8f9ad 100644 (file)
@@ -62,11 +62,6 @@ public class KnownSonesPage extends SoneTemplatePage {
                Pagination<Sone> sonePagination = new Pagination<Sone>(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);
-               }
        }
 
 }
index cf79b4d..7381f80 100644 (file)
@@ -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);
-                       }
-               }
        }
 
        //
index fe63b34..b62e19c 100644 (file)
@@ -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);
-               }
        }
 
 }
index 82284d5..53702f7 100644 (file)
@@ -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<Post> repliedPostPagination = new Pagination<Post>(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<Post>().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);
-                       }
-               }
        }
 
 }