From bab10770a77f5f756a58c4ca6f19dd51e1b492ee Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Fri, 20 Aug 2021 11:25:44 +0300 Subject: map NSFW tag to as:sensitive ActivityPub property --- src/test/java/com/juick/MessageTest.java | 6 ++++++ src/test/java/com/juick/server/tests/ServerTests.java | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'src/test/java') diff --git a/src/test/java/com/juick/MessageTest.java b/src/test/java/com/juick/MessageTest.java index cb4f4e45..9c079fa3 100644 --- a/src/test/java/com/juick/MessageTest.java +++ b/src/test/java/com/juick/MessageTest.java @@ -232,4 +232,10 @@ public class MessageTest { "\n" + "if [ \"$?\" -ne \"0\" ]; then\n"); } + @Test + public void sensitiveTest() { + Message testMessage = MockUtils.mockMessage(514, MockUtils.mockUser(5432, "rtfmpls", "secret"), "yo"); + testMessage.setTags(MessageUtils.parseTags("NSFW test")); + assertThat(MessageUtils.isSensitive(testMessage), is(true)); + } } diff --git a/src/test/java/com/juick/server/tests/ServerTests.java b/src/test/java/com/juick/server/tests/ServerTests.java index c37d70bc..f8e0f6a8 100644 --- a/src/test/java/com/juick/server/tests/ServerTests.java +++ b/src/test/java/com/juick/server/tests/ServerTests.java @@ -1816,8 +1816,9 @@ public class ServerTests { public void activitySerialization() throws Exception { Message msgNoTags = commandsManager.processCommand(ugnich, "people", emptyUri).getNewMessage().get(); String json = jsonMapper.writeValueAsString(Context.build(activityPubManager.makeNote(msgNoTags))); - Message msg = commandsManager.processCommand(ugnich, "*shit happens", emptyUri).getNewMessage().get(); + Message msg = commandsManager.processCommand(ugnich, "*NSFW *shit happens", emptyUri).getNewMessage().get(); Note note = activityPubManager.makeNote(msg); + assertThat(note.isSensitive(), is(true)); json = jsonMapper.writeValueAsString(Context.build(note)); Note replyNote = new Note(); replyNote.setId("http://localhost:8080/n/2-1"); -- cgit v1.2.3