From: David ‘Bombe’ Roden Date: Fri, 5 Jul 2013 18:59:32 +0000 (+0200) Subject: Filter empty albums on gallery pages. X-Git-Tag: 0.8.6^2~4 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=daaf67fed382cea5c2a1e35e3e5f5b6414b007b6;p=Sone.git Filter empty albums on gallery pages. --- diff --git a/src/main/java/net/pterodactylus/sone/web/ImageBrowserPage.java b/src/main/java/net/pterodactylus/sone/web/ImageBrowserPage.java index 37268ec..37ab701 100644 --- a/src/main/java/net/pterodactylus/sone/web/ImageBrowserPage.java +++ b/src/main/java/net/pterodactylus/sone/web/ImageBrowserPage.java @@ -17,6 +17,8 @@ package net.pterodactylus.sone.web; +import static net.pterodactylus.sone.data.Album.FLATTENER; +import static net.pterodactylus.sone.data.Album.NOT_EMPTY; import java.net.URI; import java.util.ArrayList; import java.util.Collections; @@ -90,7 +92,7 @@ public class ImageBrowserPage extends SoneTemplatePage { templateContext.set("galleryRequested", true); List albums = new ArrayList(); for (Sone sone : webInterface.getCore().getSones()) { - albums.addAll(FluentIterable.from(sone.getAlbums()).transformAndConcat(Album.FLATTENER).toList()); + albums.addAll(FluentIterable.from(sone.getAlbums()).transformAndConcat(FLATTENER).filter(NOT_EMPTY).toList()); } Collections.sort(albums, Album.TITLE_COMPARATOR); Pagination albumPagination = new Pagination(albums, 12).setPage(Numbers.safeParseInteger(request.getHttpRequest().getParam("page"), 0));