aboutsummaryrefslogtreecommitdiff
path: root/juick-www
diff options
context:
space:
mode:
Diffstat (limited to 'juick-www')
-rw-r--r--juick-www/src/main/java/com/juick/www/controllers/NewMessage.java6
-rw-r--r--juick-www/src/test/java/com/juick/WebAppTests.java1
2 files changed, 4 insertions, 3 deletions
diff --git a/juick-www/src/main/java/com/juick/www/controllers/NewMessage.java b/juick-www/src/main/java/com/juick/www/controllers/NewMessage.java
index 3186b796..83faf3a7 100644
--- a/juick-www/src/main/java/com/juick/www/controllers/NewMessage.java
+++ b/juick-www/src/main/java/com/juick/www/controllers/NewMessage.java
@@ -18,6 +18,7 @@ package com.juick.www.controllers;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
+import com.juick.Message;
import com.juick.User;
import com.juick.server.helpers.AnonymousUser;
import com.juick.server.helpers.CommandResult;
@@ -252,14 +253,15 @@ public class NewMessage {
try {
ResponseEntity<CommandResult> result = rest.postForEntity(postUri,
request, CommandResult.class);
- if (result.getBody().getNewMessage().isPresent()) {
+ Message newMessage = result.getBody().getNewMessage().orElse(new Message());
+ if (newMessage.getMid() > 0) {
logger.info("/post: {}", jsonMapper.writeValueAsString(result.getBody()));
} else {
logger.info("{} : {}", body, result.getBody().getText());
}
if (StringUtils.isBlank(referer) || referer.substring(0, 21).equals("http://juick.com/post")
|| referer.substring(0, 22).equals("https://juick.com/post")) {
- return "redirect:/?show=my";
+ return String.format("redirect:/%d", newMessage.getMid());
}
} catch (HttpClientErrorException e) {
logger.error("post error", e);
diff --git a/juick-www/src/test/java/com/juick/WebAppTests.java b/juick-www/src/test/java/com/juick/WebAppTests.java
index 39e2b70e..9fb214ea 100644
--- a/juick-www/src/test/java/com/juick/WebAppTests.java
+++ b/juick-www/src/test/java/com/juick/WebAppTests.java
@@ -239,7 +239,6 @@ public class WebAppTests {
}
@Test
public void postMessageTests() throws Exception {
- //assertThat(xmpp.getInConnections().size(), is(0));
mockMvc.perform(post("/post2").param("body", "yo")).andExpect(redirectedUrl("http://localhost/login"));
MvcResult loginResult = mockMvc.perform(post("/login")
.param("username", ugnichName)