X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Ftemplate%2FSoneAccessor.java;h=23b222733ef46dd825923f6904f0dff5aa4e86d5;hb=963582b5c941b1abb4fa26555aece340184956e1;hp=ac4ab2850e6c18c31658c030a5db293d5661d655;hpb=7edffb4478bdeae16b009bced9d6769d0cb50a3b;p=Sone.git
diff --git a/src/main/java/net/pterodactylus/sone/template/SoneAccessor.java b/src/main/java/net/pterodactylus/sone/template/SoneAccessor.java
index ac4ab28..23b2227 100644
--- a/src/main/java/net/pterodactylus/sone/template/SoneAccessor.java
+++ b/src/main/java/net/pterodactylus/sone/template/SoneAccessor.java
@@ -27,8 +27,8 @@ import net.pterodactylus.sone.data.Sone;
import net.pterodactylus.sone.freenet.wot.Trust;
import net.pterodactylus.util.logging.Logging;
import net.pterodactylus.util.template.Accessor;
-import net.pterodactylus.util.template.DataProvider;
import net.pterodactylus.util.template.ReflectionAccessor;
+import net.pterodactylus.util.template.TemplateContext;
/**
* {@link Accessor} for {@link Sone}s that adds a couple of properties to Sones.
@@ -39,7 +39,7 @@ import net.pterodactylus.util.template.ReflectionAccessor;
*
friend
* Will return {@code true} if the sone in question is a friend of the
* currently logged in Sone (as determined by accessing the âcurrentSoneâ
- * variable of the given {@link DataProvider}).
+ * variable of the given {@link TemplateContext}).
* current
* Will return {@code true} if the sone in question is the currently logged
* in Sone.
@@ -69,17 +69,17 @@ public class SoneAccessor extends ReflectionAccessor {
* {@inheritDoc}
*/
@Override
- public Object get(DataProvider dataProvider, Object object, String member) {
+ public Object get(TemplateContext templateContext, Object object, String member) {
Sone sone = (Sone) object;
if (member.equals("niceName")) {
return getNiceName(sone);
} else if (member.equals("local")) {
- return sone.getInsertUri() != null;
+ return core.isLocalSone(sone);
} else if (member.equals("friend")) {
- Sone currentSone = (Sone) dataProvider.get("currentSone");
+ Sone currentSone = (Sone) templateContext.get("currentSone");
return (currentSone != null) && currentSone.hasFriend(sone.getId());
} else if (member.equals("current")) {
- Sone currentSone = (Sone) dataProvider.get("currentSone");
+ Sone currentSone = (Sone) templateContext.get("currentSone");
return (currentSone != null) && currentSone.equals(sone);
} else if (member.equals("modified")) {
return core.isModifiedSone(sone);
@@ -94,11 +94,11 @@ public class SoneAccessor extends ReflectionAccessor {
} else if (member.equals("downloading")) {
return core.getSoneStatus(sone) == SoneStatus.downloading;
} else if (member.equals("new")) {
- return core.isNewSone(sone.getId(), false);
+ return core.isNewSone(sone.getId());
} else if (member.equals("locked")) {
return core.isLocked(sone);
} else if (member.equals("trust")) {
- Sone currentSone = (Sone) dataProvider.get("currentSone");
+ Sone currentSone = (Sone) templateContext.get("currentSone");
if (currentSone == null) {
return null;
}
@@ -109,7 +109,7 @@ public class SoneAccessor extends ReflectionAccessor {
}
return trust;
}
- return super.get(dataProvider, object, member);
+ return super.get(templateContext, object, member);
}
//