aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2019-05-28 19:57:18 +0300
committerGravatar Vitaly Takmazov2019-05-28 19:57:18 +0300
commit8f5441d43dcb9a7851ec3c79f1714eb47aa25a6f (patch)
treeaca76a672f1972895ed3dd879a4095bda3e91c86 /src
parent51af554f75475019911246cf675fe661c5a04b4a (diff)
PROTOCOL CHANGES in mastodon 2.8(?)
Diffstat (limited to 'src')
-rw-r--r--src/main/java/com/juick/server/api/activity/Profile.java7
-rw-r--r--src/test/java/com/juick/server/tests/ServerTests.java2
-rw-r--r--src/test/resources/delete_v3.json1
3 files changed, 10 insertions, 0 deletions
diff --git a/src/main/java/com/juick/server/api/activity/Profile.java b/src/main/java/com/juick/server/api/activity/Profile.java
index a7ba65a5..7ec3f228 100644
--- a/src/main/java/com/juick/server/api/activity/Profile.java
+++ b/src/main/java/com/juick/server/api/activity/Profile.java
@@ -353,6 +353,13 @@ public class Profile {
}
}
if (activity instanceof Delete) {
+ if (activity.getObject() instanceof String) {
+ // Delete gone user
+ // TODO: check if it is really deleted and remove copy-paste
+ if (activity.getActor().equals(activity.getObject())) {
+ return new ResponseEntity<>(CommandResult.fromString("Delete request accepted"), HttpStatus.ACCEPTED);
+ }
+ }
Map<String, Object> tombstone = (Map<String, Object>) activity.getObject();
if (tombstone.get("type").equals("Tombstone")) {
URI actor = URI.create(activity.getActor());
diff --git a/src/test/java/com/juick/server/tests/ServerTests.java b/src/test/java/com/juick/server/tests/ServerTests.java
index a140e9f0..5d13095b 100644
--- a/src/test/java/com/juick/server/tests/ServerTests.java
+++ b/src/test/java/com/juick/server/tests/ServerTests.java
@@ -1708,6 +1708,8 @@ public class ServerTests {
String undoPleromaStr = IOUtils.toString(new ClassPathResource("undo_pleroma.json").getURI(), StandardCharsets.UTF_8);
Undo undoPleroma = jsonMapper.readValue(undoPleromaStr, Undo.class);
String undoPleromaFollower = (String)((Map)undoPleroma.getObject()).get("object");
+ String deletev3JsonStr = IOUtils.toString(new ClassPathResource("delete_v3.json").getURI(), StandardCharsets.UTF_8);
+ Delete deleteObject = jsonMapper.readValue(deletev3JsonStr, Delete.class);
}
@Test
public void activitySerialization() throws Exception {
diff --git a/src/test/resources/delete_v3.json b/src/test/resources/delete_v3.json
new file mode 100644
index 00000000..1dfb0dbf
--- /dev/null
+++ b/src/test/resources/delete_v3.json
@@ -0,0 +1 @@
+{"@context":"https://www.w3.org/ns/activitystreams","id":"https://rspod.dns-cloud.net/users/kreastr#delete","type":"Delete","actor":"https://rspod.dns-cloud.net/users/kreastr","to":["https://www.w3.org/ns/activitystreams#Public"],"object":"https://rspod.dns-cloud.net/users/kreastr","signature":{"type":"RsaSignature2017","creator":"https://rspod.dns-cloud.net/users/kreastr#main-key","created":"2019-05-17T09:26:22Z","signatureValue":"RmavUUPR0xn2Mb3INUelMNGgn4bf103s29lAJyGp/Eg9NdDGc+QMwyxVaosJUeTazpt/VF46aKiVz0EsRxdBlPhaplyvrss6CZBQHwb7+tKnZNLx0qLZpL1M3dIIBNEHod8FU33ZP8uAVX2HoOs7/WS2T2Lh4nfBYZ9f53dcC3ZiKayuiKn3wVwuZepvnLRLfyF5FC/3AWkPw9MsFHMly2hwp/K6PHkFUilgjbir63d3M5HZYsTXbUVjqjvgSH2Wp+SscSDnNTHrERDLbuUYqEukS9xjTp32bq0Ok4mgM024++helxMYcWJujPhyJLI4vkbQYj5HEBmknXGCxw6tQg=="}} \ No newline at end of file