projects
/
Sone.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
🔀 Merge branch 'release/v82'
[Sone.git]
/
src
/
main
/
java
/
net
/
pterodactylus
/
sone
/
template
/
SoneAccessor.java
diff --git
a/src/main/java/net/pterodactylus/sone/template/SoneAccessor.java
b/src/main/java/net/pterodactylus/sone/template/SoneAccessor.java
index
ab872d9
..
b072dc9
100644
(file)
--- a/
src/main/java/net/pterodactylus/sone/template/SoneAccessor.java
+++ b/
src/main/java/net/pterodactylus/sone/template/SoneAccessor.java
@@
-1,5
+1,5
@@
/*
/*
- * Sone - SoneAccessor.java - Copyright © 2010–20
13
David Roden
+ * Sone - SoneAccessor.java - Copyright © 2010–20
20
David Roden
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@
-17,10
+17,7
@@
package net.pterodactylus.sone.template;
package net.pterodactylus.sone.template;
-import static com.google.common.collect.FluentIterable.from;
-import static java.util.Arrays.asList;
-import static net.pterodactylus.sone.data.Album.FLATTENER;
-import static net.pterodactylus.sone.data.Album.IMAGES;
+import static java.util.logging.Logger.getLogger;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.logging.Level;
import java.util.logging.Logger;
@@
-29,11
+26,10
@@
import net.pterodactylus.sone.core.Core;
import net.pterodactylus.sone.data.Profile;
import net.pterodactylus.sone.data.Sone;
import net.pterodactylus.sone.data.Sone.SoneStatus;
import net.pterodactylus.sone.data.Profile;
import net.pterodactylus.sone.data.Sone;
import net.pterodactylus.sone.data.Sone.SoneStatus;
+import net.pterodactylus.sone.data.SoneKt;
import net.pterodactylus.sone.freenet.wot.OwnIdentity;
import net.pterodactylus.sone.freenet.wot.Trust;
import net.pterodactylus.sone.freenet.wot.OwnIdentity;
import net.pterodactylus.sone.freenet.wot.Trust;
-import net.pterodactylus.sone.web.WebInterface;
-import net.pterodactylus.sone.web.ajax.GetTimesAjaxPage;
-import net.pterodactylus.util.logging.Logging;
+import net.pterodactylus.sone.text.TimeTextConverter;
import net.pterodactylus.util.template.Accessor;
import net.pterodactylus.util.template.ReflectionAccessor;
import net.pterodactylus.util.template.TemplateContext;
import net.pterodactylus.util.template.Accessor;
import net.pterodactylus.util.template.ReflectionAccessor;
import net.pterodactylus.util.template.TemplateContext;
@@
-52,16
+48,15
@@
import net.pterodactylus.util.template.TemplateContext;
* <dd>Will return {@code true} if the sone in question is the currently logged
* in Sone.</dd>
* </dl>
* <dd>Will return {@code true} if the sone in question is the currently logged
* in Sone.</dd>
* </dl>
- *
- * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
*/
public class SoneAccessor extends ReflectionAccessor {
/** The logger. */
*/
public class SoneAccessor extends ReflectionAccessor {
/** The logger. */
- private static final Logger logger =
Logging.getLogger(SoneAccessor.class
);
+ private static final Logger logger =
getLogger(SoneAccessor.class.getName()
);
/** The core. */
private final Core core;
/** The core. */
private final Core core;
+ private final TimeTextConverter timeTextConverter;
/**
* Creates a new Sone accessor.
/**
* Creates a new Sone accessor.
@@
-69,8
+64,9
@@
public class SoneAccessor extends ReflectionAccessor {
* @param core
* The Sone core
*/
* @param core
* The Sone core
*/
- public SoneAccessor(Core core) {
+ public SoneAccessor(Core core
, TimeTextConverter timeTextConverter
) {
this.core = core;
this.core = core;
+ this.timeTextConverter = timeTextConverter;
}
/**
}
/**
@@
-104,7
+100,7
@@
public class SoneAccessor extends ReflectionAccessor {
} else if (member.equals("locked")) {
return core.isLocked(sone);
} else if (member.equals("lastUpdatedText")) {
} else if (member.equals("locked")) {
return core.isLocked(sone);
} else if (member.equals("lastUpdatedText")) {
- return
GetTimesAjaxPage.getTime((WebInterface) templateContext.get("webInterface"), sone.getTime()
);
+ return
timeTextConverter.getTimeText(sone.getTime()).getL10nText(
);
} else if (member.equals("trust")) {
Sone currentSone = (Sone) templateContext.get("currentSone");
if (currentSone == null) {
} else if (member.equals("trust")) {
Sone currentSone = (Sone) templateContext.get("currentSone");
if (currentSone == null) {
@@
-117,7
+113,9
@@
public class SoneAccessor extends ReflectionAccessor {
}
return trust;
} else if (member.equals("allImages")) {
}
return trust;
} else if (member.equals("allImages")) {
- return from(asList(sone.getRootAlbum())).transformAndConcat(FLATTENER).transformAndConcat(IMAGES);
+ return SoneKt.getAllImages(sone);
+ } else if (member.equals("albums")) {
+ return sone.getRootAlbum().getAlbums();
}
return super.get(templateContext, object, member);
}
}
return super.get(templateContext, object, member);
}