aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick/www/api
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2021-10-24 05:40:17 +0300
committerGravatar Vitaly Takmazov2021-10-24 05:40:17 +0300
commit06ad05137bdae937c6c23b02e8bf3265db52ff36 (patch)
tree34ef24ad655821a3231fd7f978c63adadb56dd3e /src/main/java/com/juick/www/api
parent9b4252fee00e2d736e5699fc15705d835c69e2fa (diff)
ActivityPub: fix deletion flow
Diffstat (limited to 'src/main/java/com/juick/www/api')
-rw-r--r--src/main/java/com/juick/www/api/activity/Profile.java17
1 files changed, 5 insertions, 12 deletions
diff --git a/src/main/java/com/juick/www/api/activity/Profile.java b/src/main/java/com/juick/www/api/activity/Profile.java
index e6a4e789..8a879f3b 100644
--- a/src/main/java/com/juick/www/api/activity/Profile.java
+++ b/src/main/java/com/juick/www/api/activity/Profile.java
@@ -383,20 +383,13 @@ public class Profile {
}
}
if (activity instanceof Delete) {
- // Delete gone user
- // TODO: check if it is really deleted and remove copy-paste
- if (activity.getActor().equals(activity.getObject().getId())) {
- return new ResponseEntity<>(CommandResult.fromString("Delete request accepted"),
- HttpStatus.ACCEPTED);
- }
-
- if (activity.getObject() instanceof Tombstone) {
- Tombstone tombstone = (Tombstone) activity.getObject();
+ URI objectId = URI.create(activity.getObject().getId());
+ if (messagesService.replyExists(objectId)) {
URI actor = URI.create(activity.getActor());
- URI reply = URI.create((String) tombstone.getId());
- messagesService.deleteReply(actor, reply);
- return new ResponseEntity<>(CommandResult.fromString("Delete request accepted"), HttpStatus.OK);
+ messagesService.deleteReply(actor, objectId);
}
+ // accept all authenticated Delete activities
+ return new ResponseEntity<>(CommandResult.fromString("Delete request accepted"), HttpStatus.OK);
}
if (activity instanceof Like || activity instanceof Announce) {
String messageUri = activity.getObject().getId();