diff options
Diffstat (limited to 'juick-server/src/main/java/com/juick')
-rw-r--r-- | juick-server/src/main/java/com/juick/server/api/activity/Profile.java | 9 | ||||
-rw-r--r-- | juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java | 5 |
2 files changed, 14 insertions, 0 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 6a35f3d9..96ed75d1 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 @@ -311,6 +311,15 @@ public class Profile { } } } + if (activity instanceof Delete) { + Map<String, Object> tombstone = (Map<String, Object>) activity.getObject(); + if (tombstone.get("type").equals("Tombstone")) { + URI actor = URI.create(activity.getActor()); + URI reply = URI.create((String)tombstone.get("id")); + messagesService.deleteReply(actor, reply); + return new ResponseEntity<>(HttpStatus.OK); + } + } logger.warn("Unknown activity: {}", jsonMapper.writeValueAsString(activity)); return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } 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 4831c9d1..838dee48 100644 --- a/juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java +++ b/juick-server/src/main/java/com/juick/service/MessagesServiceImpl.java @@ -1112,4 +1112,9 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ return jdbcTemplate.queryForList("SELECT reply_id FROM replies WHERE reply_uri=?", Integer.class, replyUri.toASCIIString()).size() > 0; } + + @Override + public boolean deleteReply(URI userUri, URI replyUri) { + return jdbcTemplate.update("DELETE FROM replies WHERE user_uri=? AND reply_uri=?", userUri, replyUri) > 0; + } } |