diff options
author | Vitaly Takmazov | 2019-01-30 12:34:04 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2019-01-30 12:34:04 +0300 |
commit | 053300c67d2fe274f2f562712d8586e81700c085 (patch) | |
tree | 9d04c085cdd00c9731791e8f6400027de9e4c52c /src/main/java/com | |
parent | 362d1362797d1736505084f96d34dd287fb22945 (diff) |
Corrected flow for federated user deletion
Diffstat (limited to 'src/main/java/com')
-rw-r--r-- | src/main/java/com/juick/server/api/activity/Profile.java | 17 |
1 files changed, 10 insertions, 7 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 84a3de33..b1d325f9 100644 --- a/src/main/java/com/juick/server/api/activity/Profile.java +++ b/src/main/java/com/juick/server/api/activity/Profile.java @@ -284,13 +284,6 @@ public class Profile { return new ResponseEntity<>(HttpStatus.OK); } } - if (activity instanceof Delete) { - if (activity.getObject() instanceof String) { - // Delete user - applicationEventPublisher.publishEvent(new DeleteUserEvent(this, (String)activity.getObject())); - return new ResponseEntity<>(HttpStatus.OK); - } - } if (activity instanceof Create) { if (activity.getObject() instanceof Map) { Map<String, Object> note = (Map<String, Object>) activity.getObject(); @@ -361,6 +354,16 @@ public class Profile { logger.warn("Unknown activity: {}", jsonMapper.writeValueAsString(activity)); return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } + if (activity instanceof Delete) { + if (activity.getObject() instanceof String) { + // Delete gone user + if (activity.getActor().equals(activity.getObject())) { + if (signatureManager.getContext(URI.create(activity.getActor())).isEmpty()) { + return new ResponseEntity<>(HttpStatus.ACCEPTED); + } + } + } + } return new ResponseEntity<>(HttpStatus.UNAUTHORIZED); } @PostMapping(value = "/u/", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) |