projects
/
Sone.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Don’t list replies to unknown posts.
[Sone.git]
/
src
/
main
/
java
/
net
/
pterodactylus
/
sone
/
web
/
ajax
/
GetPostAjaxPage.java
diff --git
a/src/main/java/net/pterodactylus/sone/web/ajax/GetPostAjaxPage.java
b/src/main/java/net/pterodactylus/sone/web/ajax/GetPostAjaxPage.java
index
127834b
..
f56c5b7
100644
(file)
--- a/
src/main/java/net/pterodactylus/sone/web/ajax/GetPostAjaxPage.java
+++ b/
src/main/java/net/pterodactylus/sone/web/ajax/GetPostAjaxPage.java
@@
-62,7
+62,7
@@
public class GetPostAjaxPage extends JsonPage {
if (post == null) {
return createErrorJsonObject("invalid-post-id");
}
if (post == null) {
return createErrorJsonObject("invalid-post-id");
}
- return createSuccessJsonObject().put("post", createJsonPost(post, getCurrentSone(request.getToadletContext())));
+ return createSuccessJsonObject().put("post", createJsonPost(
request,
post, getCurrentSone(request.getToadletContext())));
}
/**
}
/**
@@
-81,13
+81,15
@@
public class GetPostAjaxPage extends JsonPage {
* Creates a JSON object from the given post. The JSON object will only
* contain the ID of the post, its time, and its rendered HTML code.
*
* Creates a JSON object from the given post. The JSON object will only
* contain the ID of the post, its time, and its rendered HTML code.
*
+ * @param request
+ * The request being processed
* @param post
* The post to create a JSON object from
* @param currentSone
* The currently logged in Sone (to store in the template)
* @return The JSON representation of the post
*/
* @param post
* The post to create a JSON object from
* @param currentSone
* The currently logged in Sone (to store in the template)
* @return The JSON representation of the post
*/
- private JsonObject createJsonPost(Post post, Sone currentSone) {
+ private JsonObject createJsonPost(
Request request,
Post post, Sone currentSone) {
JsonObject jsonPost = new JsonObject();
jsonPost.put("id", post.getId());
jsonPost.put("sone", post.getSone().getId());
JsonObject jsonPost = new JsonObject();
jsonPost.put("id", post.getId());
jsonPost.put("sone", post.getSone().getId());
@@
-95,8
+97,11
@@
public class GetPostAjaxPage extends JsonPage {
jsonPost.put("time", post.getTime());
StringWriter stringWriter = new StringWriter();
TemplateContext templateContext = webInterface.getTemplateContextFactory().createTemplateContext();
jsonPost.put("time", post.getTime());
StringWriter stringWriter = new StringWriter();
TemplateContext templateContext = webInterface.getTemplateContextFactory().createTemplateContext();
+ templateContext.set("core", webInterface.getCore());
+ templateContext.set("request", request);
templateContext.set("post", post);
templateContext.set("currentSone", currentSone);
templateContext.set("post", post);
templateContext.set("currentSone", currentSone);
+ templateContext.set("localSones", webInterface.getCore().getLocalSones());
try {
postTemplate.render(templateContext, stringWriter);
} catch (TemplateException te1) {
try {
postTemplate.render(templateContext, stringWriter);
} catch (TemplateException te1) {