Don’t store the insert URI in the information used to create the insert.
[Sone.git] / src / main / java / net / pterodactylus / sone / core / SoneInserter.java
index 01e414d..36eb300 100644 (file)
@@ -18,6 +18,7 @@
 package net.pterodactylus.sone.core;
 
 import static com.google.common.base.Preconditions.checkArgument;
+import static net.pterodactylus.sone.data.Album.NOT_EMPTY;
 
 import java.io.InputStreamReader;
 import java.io.StringWriter;
@@ -50,13 +51,13 @@ import net.pterodactylus.util.template.TemplateException;
 import net.pterodactylus.util.template.TemplateParser;
 import net.pterodactylus.util.template.XmlFilter;
 
+import freenet.client.async.ManifestElement;
+import freenet.keys.FreenetURI;
+
 import com.google.common.collect.FluentIterable;
 import com.google.common.collect.Ordering;
 import com.google.common.eventbus.EventBus;
 
-import freenet.client.async.ManifestElement;
-import freenet.keys.FreenetURI;
-
 /**
  * A Sone inserter is responsible for inserting a Sone if it has changed.
  *
@@ -182,9 +183,6 @@ public class SoneInserter extends AbstractService {
        // SERVICE METHODS
        //
 
-       /**
-        * {@inheritDoc}
-        */
        @Override
        protected void serviceRun() {
                long lastModificationTime = 0;
@@ -302,13 +300,12 @@ public class SoneInserter extends AbstractService {
                        soneProperties.put("name", sone.getName());
                        soneProperties.put("time", sone.getTime());
                        soneProperties.put("requestUri", sone.getRequestUri());
-                       soneProperties.put("insertUri", sone.getInsertUri());
                        soneProperties.put("profile", sone.getProfile());
                        soneProperties.put("posts", Ordering.from(Post.TIME_COMPARATOR).sortedCopy(sone.getPosts()));
                        soneProperties.put("replies", Ordering.from(Reply.TIME_COMPARATOR).reverse().sortedCopy(sone.getReplies()));
                        soneProperties.put("likedPostIds", new HashSet<String>(sone.getLikedPostIds()));
                        soneProperties.put("likedReplyIds", new HashSet<String>(sone.getLikedReplyIds()));
-                       soneProperties.put("albums", FluentIterable.from(sone.getAlbums()).transformAndConcat(Album.FLATTENER).toList());
+                       soneProperties.put("albums", FluentIterable.from(sone.getRootAlbum().getAlbums()).transformAndConcat(Album.FLATTENER).filter(NOT_EMPTY).toList());
                }
 
                //