From 6bdcd41b92f9a6acd014612d35a54e54e41a9dd0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Mon, 28 Jan 2013 08:44:29 +0100 Subject: [PATCH] Remove hasRecipient method. --- src/main/java/net/pterodactylus/sone/data/Post.java | 8 -------- src/main/java/net/pterodactylus/sone/data/impl/PostImpl.java | 8 -------- src/main/java/net/pterodactylus/sone/fcp/AbstractSoneCommand.java | 2 +- src/main/resources/templates/include/viewPost.html | 4 ++-- 4 files changed, 3 insertions(+), 19 deletions(-) diff --git a/src/main/java/net/pterodactylus/sone/data/Post.java b/src/main/java/net/pterodactylus/sone/data/Post.java index 5269fe4..6523e9b 100644 --- a/src/main/java/net/pterodactylus/sone/data/Post.java +++ b/src/main/java/net/pterodactylus/sone/data/Post.java @@ -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. * diff --git a/src/main/java/net/pterodactylus/sone/data/impl/PostImpl.java b/src/main/java/net/pterodactylus/sone/data/impl/PostImpl.java index 5d0d72a..2d25715 100644 --- a/src/main/java/net/pterodactylus/sone/data/impl/PostImpl.java +++ b/src/main/java/net/pterodactylus/sone/data/impl/PostImpl.java @@ -103,14 +103,6 @@ public class PostImpl implements Post { * {@inheritDocs} */ @Override - public boolean hasRecipient() { - return recipientId != null; - } - - /** - * {@inheritDocs} - */ - @Override public Optional getRecipientId() { return Optional.fromNullable(recipientId); } diff --git a/src/main/java/net/pterodactylus/sone/fcp/AbstractSoneCommand.java b/src/main/java/net/pterodactylus/sone/fcp/AbstractSoneCommand.java index 108a80f..8601a52 100644 --- a/src/main/java/net/pterodactylus/sone/fcp/AbstractSoneCommand.java +++ b/src/main/java/net/pterodactylus/sone/fcp/AbstractSoneCommand.java @@ -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()); diff --git a/src/main/resources/templates/include/viewPost.html b/src/main/resources/templates/include/viewPost.html index b46532f..efc3d53 100644 --- a/src/main/resources/templates/include/viewPost.html +++ b/src/main/resources/templates/include/viewPost.html @@ -18,9 +18,9 @@
class="hidden"<%/if>> - <%if post.hasRecipient> + <%if post.recipientId.present> → - <%ifnull post.recipient.orNull> + <%if !post.recipient.present> <%else> -- 2.7.4