projects
/
Sone.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Use new plugin name of the web of trust plugin.
[Sone.git]
/
src
/
main
/
java
/
net
/
pterodactylus
/
sone
/
template
/
ReplyAccessor.java
diff --git
a/src/main/java/net/pterodactylus/sone/template/ReplyAccessor.java
b/src/main/java/net/pterodactylus/sone/template/ReplyAccessor.java
index
1ec4e04
..
f439abe
100644
(file)
--- a/
src/main/java/net/pterodactylus/sone/template/ReplyAccessor.java
+++ b/
src/main/java/net/pterodactylus/sone/template/ReplyAccessor.java
@@
-17,17
+17,12
@@
package net.pterodactylus.sone.template;
package net.pterodactylus.sone.template;
-import java.io.IOException;
-import java.io.StringReader;
-
import net.pterodactylus.sone.core.Core;
import net.pterodactylus.sone.data.Reply;
import net.pterodactylus.sone.data.Sone;
import net.pterodactylus.sone.core.Core;
import net.pterodactylus.sone.data.Reply;
import net.pterodactylus.sone.data.Sone;
-import net.pterodactylus.sone.text.FreenetLinkParser;
import net.pterodactylus.util.template.Accessor;
import net.pterodactylus.util.template.Accessor;
-import net.pterodactylus.util.template.DataProvider;
import net.pterodactylus.util.template.ReflectionAccessor;
import net.pterodactylus.util.template.ReflectionAccessor;
-import net.pterodactylus.util.template.Template
Factory
;
+import net.pterodactylus.util.template.Template
Context
;
/**
* {@link Accessor} implementation that adds a couple of properties to
/**
* {@link Accessor} implementation that adds a couple of properties to
@@
-37,9
+32,6
@@
import net.pterodactylus.util.template.TemplateFactory;
*/
public class ReplyAccessor extends ReflectionAccessor {
*/
public class ReplyAccessor extends ReflectionAccessor {
- /** Parser for Freenet links. */
- private final FreenetLinkParser linkParser;
-
/** The core. */
private final Core core;
/** The core. */
private final Core core;
@@
-48,36
+40,26
@@
public class ReplyAccessor extends ReflectionAccessor {
*
* @param core
* The core
*
* @param core
* The core
- * @param templateFactory
- * The template factory for the text parser
*/
*/
- public ReplyAccessor(Core core
, TemplateFactory templateFactory
) {
+ public ReplyAccessor(Core core) {
this.core = core;
this.core = core;
- linkParser = new FreenetLinkParser(templateFactory);
}
/**
* {@inheritDoc}
*/
@Override
}
/**
* {@inheritDoc}
*/
@Override
- public Object get(
DataProvider dataProvider
, Object object, String member) {
+ public Object get(
TemplateContext templateContext
, Object object, String member) {
Reply reply = (Reply) object;
if ("likes".equals(member)) {
return core.getLikes(reply);
} else if (member.equals("liked")) {
Reply reply = (Reply) object;
if ("likes".equals(member)) {
return core.getLikes(reply);
} else if (member.equals("liked")) {
- Sone currentSone = (Sone)
dataProvider.getData
("currentSone");
+ Sone currentSone = (Sone)
templateContext.get
("currentSone");
return (currentSone != null) && (currentSone.isLikedReplyId(reply.getId()));
} else if (member.equals("new")) {
return (currentSone != null) && (currentSone.isLikedReplyId(reply.getId()));
} else if (member.equals("new")) {
- return core.isNewReply(reply.getId(), false);
- } else if (member.equals("text")) {
- String text = reply.getText();
- try {
- return linkParser.parse(new StringReader(text));
- } catch (IOException ioe1) {
- /* ignore. */
- }
+ return core.isNewReply(reply.getId());
}
}
- return super.get(
dataProvider
, object, member);
+ return super.get(
templateContext
, object, member);
}
}
}
}