projects
/
Sone.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
9dafc7d
)
Mark shown posts and replies known.
author
David ‘Bombe’ Roden
<bombe@pterodactylus.net>
Thu, 25 Nov 2010 11:14:57 +0000
(12:14 +0100)
committer
David ‘Bombe’ Roden
<bombe@pterodactylus.net>
Thu, 25 Nov 2010 11:14:57 +0000
(12:14 +0100)
src/main/java/net/pterodactylus/sone/web/IndexPage.java
patch
|
blob
|
history
src/main/java/net/pterodactylus/sone/web/ViewPostPage.java
patch
|
blob
|
history
src/main/java/net/pterodactylus/sone/web/ViewSonePage.java
patch
|
blob
|
history
diff --git
a/src/main/java/net/pterodactylus/sone/web/IndexPage.java
b/src/main/java/net/pterodactylus/sone/web/IndexPage.java
index
00ccc35
..
7562526
100644
(file)
--- a/
src/main/java/net/pterodactylus/sone/web/IndexPage.java
+++ b/
src/main/java/net/pterodactylus/sone/web/IndexPage.java
@@
-22,6
+22,7
@@
import java.util.Collections;
import java.util.List;
import net.pterodactylus.sone.data.Post;
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.template.Template;
import net.pterodactylus.sone.data.Sone;
import net.pterodactylus.util.template.Template;
@@
-66,4
+67,19
@@
public class IndexPage extends SoneTemplatePage {
template.set("posts", allPosts);
}
template.set("posts", allPosts);
}
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void postProcess(Request request, Template template) {
+ @SuppressWarnings("unchecked")
+ List<Post> posts = (List<Post>) template.get("posts");
+ for (Post post : posts) {
+ 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
9bc28fa
..
3bc3b36
100644
(file)
--- a/
src/main/java/net/pterodactylus/sone/web/ViewPostPage.java
+++ b/
src/main/java/net/pterodactylus/sone/web/ViewPostPage.java
@@
-18,6
+18,7
@@
package net.pterodactylus.sone.web;
import net.pterodactylus.sone.data.Post;
package net.pterodactylus.sone.web;
import net.pterodactylus.sone.data.Post;
+import net.pterodactylus.sone.data.Reply;
import net.pterodactylus.util.template.Template;
/**
import net.pterodactylus.util.template.Template;
/**
@@
-54,4
+55,16
@@
public class ViewPostPage extends SoneTemplatePage {
template.set("post", post);
}
template.set("post", post);
}
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void postProcess(Request request, Template template) {
+ Post post = (Post) template.get("post");
+ 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
8b88f2e
..
d933bc7
100644
(file)
--- a/
src/main/java/net/pterodactylus/sone/web/ViewSonePage.java
+++ b/
src/main/java/net/pterodactylus/sone/web/ViewSonePage.java
@@
-17,6
+17,10
@@
package net.pterodactylus.sone.web;
package net.pterodactylus.sone.web;
+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.template.Template;
import net.pterodactylus.sone.data.Sone;
import net.pterodactylus.util.template.Template;
@@
-54,4
+58,19
@@
public class ViewSonePage extends SoneTemplatePage {
template.set("sone", sone);
}
template.set("sone", sone);
}
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void postProcess(Request request, Template template) {
+ Sone sone = (Sone) template.get("sone");
+ List<Post> posts = sone.getPosts();
+ for (Post post : posts) {
+ webInterface.getCore().markPostKnown(post);
+ for (Reply reply : webInterface.getCore().getReplies(post)) {
+ webInterface.getCore().markReplyKnown(reply);
+ }
+ }
+ }
+
}
}