Remove hasRecipient method.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Mon, 28 Jan 2013 07:44:29 +0000 (08:44 +0100)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Mon, 28 Jan 2013 07:44:29 +0000 (08:44 +0100)
src/main/java/net/pterodactylus/sone/data/Post.java
src/main/java/net/pterodactylus/sone/data/impl/PostImpl.java
src/main/java/net/pterodactylus/sone/fcp/AbstractSoneCommand.java
src/main/resources/templates/include/viewPost.html

index 5269fe4..6523e9b 100644 (file)
@@ -69,14 +69,6 @@ public interface Post {
        public Sone getSone();
 
        /**
-        * Returns whether this post has a recipient.
-        *
-        * @return {@code true} if this post has a recipient, {@code false}
-        *         otherwise
-        */
-       public boolean hasRecipient();
-
-       /**
         * Returns the ID of the recipient {@link Sone}, or
         * {@link Optional#absent()} if this post does not have a recipient.
         *
index 5d0d72a..2d25715 100644 (file)
@@ -103,14 +103,6 @@ public class PostImpl implements Post {
         * {@inheritDocs}
         */
        @Override
-       public boolean hasRecipient() {
-               return recipientId != null;
-       }
-
-       /**
-        * {@inheritDocs}
-        */
-       @Override
        public Optional<String> getRecipientId() {
                return Optional.fromNullable(recipientId);
        }
index 108a80f..8601a52 100644 (file)
@@ -301,7 +301,7 @@ public abstract class AbstractSoneCommand extends AbstractCommand {
 
                postBuilder.put(prefix + "ID", post.getId());
                postBuilder.put(prefix + "Sone", post.getSone().getId());
-               if (post.hasRecipient()) {
+               if (post.getRecipientId().isPresent()) {
                        postBuilder.put(prefix + "Recipient", post.getRecipientId().get());
                }
                postBuilder.put(prefix + "Time", post.getTime());
index b46532f..efc3d53 100644 (file)
@@ -18,9 +18,9 @@
        <div class="inner-part">
                <div<%if !post.loaded> class="hidden"<%/if>>
                        <div class="author profile-link"><a href="viewSone.html?sone=<% post.sone.id|html>"><% post.sone.niceName|html></a></div>
-                       <%if post.hasRecipient>
+                       <%if post.recipientId.present>
                                <span class="recipient-to">→</span>
-                               <%ifnull post.recipient.orNull>
+                               <%if !post.recipient.present>
                                        <div class="recipient profile-link"><a href="viewSone.html?sone=<% post.recipientId.get|html>"><%= View.Post.UnknownAuthor|l10n|html></a></div>
                                <%else>
                                        <div class="recipient profile-link"><a href="viewSone.html?sone=<% post.recipientId.get|html>"><% post.recipient.get.niceName|html></a></div>