From: David ‘Bombe’ Roden Date: Thu, 24 Jan 2013 06:42:08 +0000 (+0100) Subject: Return ID of the post from post reply. X-Git-Tag: 0.8.5^2~3^2~58^2~2 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=cf16e1fef9f9db74f50fb1d12dbc48a552ec2a1a;p=Sone.git Return ID of the post from post reply. --- diff --git a/src/main/java/net/pterodactylus/sone/core/Core.java b/src/main/java/net/pterodactylus/sone/core/Core.java index 9bc31bb..33e57c7 100644 --- a/src/main/java/net/pterodactylus/sone/core/Core.java +++ b/src/main/java/net/pterodactylus/sone/core/Core.java @@ -2008,7 +2008,7 @@ public class Core extends AbstractService implements SoneProvider, PostProvider, for (PostReply reply : sone.getReplies()) { String replyPrefix = sonePrefix + "/Replies/" + replyCounter++; configuration.getStringValue(replyPrefix + "/ID").setValue(reply.getId()); - configuration.getStringValue(replyPrefix + "/Post/ID").setValue(reply.getPost().getId()); + configuration.getStringValue(replyPrefix + "/Post/ID").setValue(reply.getPostId()); configuration.getLongValue(replyPrefix + "/Time").setValue(reply.getTime()); configuration.getStringValue(replyPrefix + "/Text").setValue(reply.getText()); } diff --git a/src/main/java/net/pterodactylus/sone/data/PostReply.java b/src/main/java/net/pterodactylus/sone/data/PostReply.java index 4452e2e..8dc6f93 100644 --- a/src/main/java/net/pterodactylus/sone/data/PostReply.java +++ b/src/main/java/net/pterodactylus/sone/data/PostReply.java @@ -26,6 +26,13 @@ package net.pterodactylus.sone.data; public interface PostReply extends Reply { /** + * Returns the ID of the post this reply refers to. + * + * @return The ID of the post this reply refers to + */ + public String getPostId(); + + /** * Returns the post this reply refers to. * * @return The post this reply refers to diff --git a/src/main/java/net/pterodactylus/sone/data/impl/PostReplyImpl.java b/src/main/java/net/pterodactylus/sone/data/impl/PostReplyImpl.java index 017f019..fa6629e 100644 --- a/src/main/java/net/pterodactylus/sone/data/impl/PostReplyImpl.java +++ b/src/main/java/net/pterodactylus/sone/data/impl/PostReplyImpl.java @@ -53,6 +53,14 @@ public class PostReplyImpl extends ReplyImpl implements PostReply { // /** + * {@inheritDocs} + */ + @Override + public String getPostId() { + return postId; + } + + /** * {@inheritDoc} */ @Override diff --git a/src/main/java/net/pterodactylus/sone/web/SearchPage.java b/src/main/java/net/pterodactylus/sone/web/SearchPage.java index b937b2f..6cb2c0c 100644 --- a/src/main/java/net/pterodactylus/sone/web/SearchPage.java +++ b/src/main/java/net/pterodactylus/sone/web/SearchPage.java @@ -341,7 +341,7 @@ public class SearchPage extends SoneTemplatePage { if (!postReply.isPresent()) { return null; } - return postReply.get().getPost().getId(); + return postReply.get().getPostId(); } /** diff --git a/src/main/java/net/pterodactylus/sone/web/ajax/GetReplyAjaxPage.java b/src/main/java/net/pterodactylus/sone/web/ajax/GetReplyAjaxPage.java index a2ee122..b617608 100644 --- a/src/main/java/net/pterodactylus/sone/web/ajax/GetReplyAjaxPage.java +++ b/src/main/java/net/pterodactylus/sone/web/ajax/GetReplyAjaxPage.java @@ -97,7 +97,7 @@ public class GetReplyAjaxPage extends JsonPage { private JsonObject createJsonReply(FreenetRequest request, PostReply reply, Sone currentSone) { JsonObject jsonReply = new JsonObject(); jsonReply.put("id", reply.getId()); - jsonReply.put("postId", reply.getPost().getId()); + jsonReply.put("postId", reply.getPostId()); jsonReply.put("soneId", reply.getSone().getId()); jsonReply.put("time", reply.getTime()); StringWriter stringWriter = new StringWriter(); diff --git a/src/main/java/net/pterodactylus/sone/web/ajax/GetStatusAjaxPage.java b/src/main/java/net/pterodactylus/sone/web/ajax/GetStatusAjaxPage.java index 8657a6a..9c4c76f 100644 --- a/src/main/java/net/pterodactylus/sone/web/ajax/GetStatusAjaxPage.java +++ b/src/main/java/net/pterodactylus/sone/web/ajax/GetStatusAjaxPage.java @@ -134,7 +134,7 @@ public class GetStatusAjaxPage extends JsonPage { JsonObject jsonReply = new JsonObject(); jsonReply.put("id", reply.getId()); jsonReply.put("sone", reply.getSone().getId()); - jsonReply.put("post", reply.getPost().getId()); + jsonReply.put("post", reply.getPostId()); jsonReply.put("postSone", reply.getPost().getSone().getId()); jsonReplies.add(jsonReply); }