aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-10-04 19:33:03 +0300
committerGravatar Vitaly Takmazov2018-10-04 19:33:03 +0300
commit0cb00c61bd1ab203c66878d3c313b6f40b4cc707 (patch)
treeb2d92995d1e33593908d9bfb420205f821452a77
parent9848227c11f3cc4c0ccf6e01d0185c5fda506e80 (diff)
fix some tests, disable Note endpoint until negotiation fixed
-rw-r--r--juick-server/src/main/java/com/juick/server/api/activity/Profile.java3
-rw-r--r--juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java8
-rw-r--r--juick-server/src/test/java/com/juick/server/tests/ServerTests.java13
3 files changed, 21 insertions, 3 deletions
diff --git a/juick-server/src/main/java/com/juick/server/api/activity/Profile.java b/juick-server/src/main/java/com/juick/server/api/activity/Profile.java
index 6fdd9d8c..5a269d03 100644
--- a/juick-server/src/main/java/com/juick/server/api/activity/Profile.java
+++ b/juick-server/src/main/java/com/juick/server/api/activity/Profile.java
@@ -221,11 +221,12 @@ public class Profile {
}
throw new HttpNotFoundException();
}
+ /*
@GetMapping(value = "/m/{mid}", produces = {Context.LD_JSON_MEDIA_TYPE, Context.ACTIVITY_JSON_MEDIA_TYPE})
public Context showNote(@PathVariable int mid) {
Message message = messagesService.getMessage(mid);
return Context.build(activityPubManager.makeNote(message));
- }
+ }*/
@PostMapping(value = "/api/inbox", consumes = {Context.LD_JSON_MEDIA_TYPE, Context.ACTIVITY_JSON_MEDIA_TYPE})
public ResponseEntity<Void> processInbox(@RequestBody Activity activity,
diff --git a/juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java b/juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java
index b0707232..e83e2705 100644
--- a/juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java
+++ b/juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java
@@ -392,7 +392,13 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ
msg.setTo(quoteUser);
}
msg.setUpdatedAt(rs.getTimestamp(10).toInstant());
-
+ if (StringUtils.isNotEmpty(msg.getAttachmentType())) {
+ try {
+ imagesService.setAttachmentMetadata(baseImagesUrl, msg);
+ } catch (Exception e) {
+ logger.warn("exception reading images for mid {} rid {}", msg.getMid(), msg.getRid(), e);
+ }
+ }
return msg;
},
mid, rid);
diff --git a/juick-server/src/test/java/com/juick/server/tests/ServerTests.java b/juick-server/src/test/java/com/juick/server/tests/ServerTests.java
index 386b989a..3c59fde0 100644
--- a/juick-server/src/test/java/com/juick/server/tests/ServerTests.java
+++ b/juick-server/src/test/java/com/juick/server/tests/ServerTests.java
@@ -1692,7 +1692,7 @@ public class ServerTests {
@Test
public void signingSpec() throws IOException {
Key fromKey = new Key();
- fromKey.setId("to-key-id");
+ fromKey.setId("http://localhost:8080/u/freefd#main-key");
Person from = new Person();
from.setPublicKey(fromKey);
Person to = new Person();
@@ -1708,4 +1708,15 @@ public class ServerTests {
.andExpect(status().isOk()).andReturn();
String xrd = result.getResponse().getContentAsString();
}
+ @Test
+ public void contentNegotiationTest() throws Exception {
+ int mid = messagesService.createMessage(ugnich.getUid(),"TXT", null, Collections.emptyList());
+ mockMvc.perform(get("/m/" + mid)
+ .header("Accept", "text/html")).andExpect(status().is3xxRedirection());
+ mockMvc.perform(get("/m/" + mid)
+ .header("Accept", "application/activity+json")).andExpect(status().isOk());
+ mockMvc.perform(get("/m/" + mid)
+ .header("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"))
+ .andExpect(status().is3xxRedirection());
+ }
}