projects
/
Sone.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Return an optional Sone from the current session.
[Sone.git]
/
src
/
main
/
java
/
net
/
pterodactylus
/
sone
/
web
/
KnownSonesPage.java
diff --git
a/src/main/java/net/pterodactylus/sone/web/KnownSonesPage.java
b/src/main/java/net/pterodactylus/sone/web/KnownSonesPage.java
index
d2e7abe
..
a741322
100644
(file)
--- a/
src/main/java/net/pterodactylus/sone/web/KnownSonesPage.java
+++ b/
src/main/java/net/pterodactylus/sone/web/KnownSonesPage.java
@@
-30,6
+30,7
@@
import net.pterodactylus.util.collection.Pagination;
import net.pterodactylus.util.template.Template;
import net.pterodactylus.util.template.TemplateContext;
import net.pterodactylus.util.template.Template;
import net.pterodactylus.util.template.TemplateContext;
+import com.google.common.base.Optional;
import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
import com.google.common.collect.Collections2;
import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
import com.google.common.collect.Collections2;
@@
-73,22
+74,22
@@
public class KnownSonesPage extends SoneTemplatePage {
templateContext.set("sort", sortField);
templateContext.set("order", sortOrder);
templateContext.set("filter", filter);
templateContext.set("sort", sortField);
templateContext.set("order", sortOrder);
templateContext.set("filter", filter);
- final
Sone
currentSone = getCurrentSone(request.getToadletContext(), false);
+ final
Optional<Sone>
currentSone = getCurrentSone(request.getToadletContext(), false);
Collection<Sone> knownSones = Collections2.filter(webInterface.getCore().getSones(), Sone.EMPTY_SONE_FILTER);
Collection<Sone> knownSones = Collections2.filter(webInterface.getCore().getSones(), Sone.EMPTY_SONE_FILTER);
- if (
(currentSone != null
) && "followed".equals(filter)) {
+ if (
currentSone.isPresent(
) && "followed".equals(filter)) {
knownSones = Collections2.filter(knownSones, new Predicate<Sone>() {
@Override
public boolean apply(Sone sone) {
knownSones = Collections2.filter(knownSones, new Predicate<Sone>() {
@Override
public boolean apply(Sone sone) {
- return currentSone.hasFriend(sone.getId());
+ return currentSone.
get().
hasFriend(sone.getId());
}
});
}
});
- } else if (
(currentSone != null
) && "not-followed".equals(filter)) {
+ } else if (
currentSone.isPresent(
) && "not-followed".equals(filter)) {
knownSones = Collections2.filter(knownSones, new Predicate<Sone>() {
@Override
public boolean apply(Sone sone) {
knownSones = Collections2.filter(knownSones, new Predicate<Sone>() {
@Override
public boolean apply(Sone sone) {
- return !currentSone.hasFriend(sone.getId());
+ return !currentSone.
get().
hasFriend(sone.getId());
}
});
} else if ("new".equals(filter)) {
}
});
} else if ("new".equals(filter)) {