diff options
author | Vitaly Takmazov | 2018-10-04 16:40:13 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2018-10-04 16:40:53 +0300 |
commit | deec8829a53e5b75a837d31c5061d5ab4ecef420 (patch) | |
tree | 1d683b8cc12ad0d8e1b833a0f1d98a3ef3294632 /juick-server/src/main/java/com/juick/server/api | |
parent | 50c3ab940b9c9fdf5e864d969cea25f509af14b8 (diff) |
ActivityPub: handle user Delete event
Diffstat (limited to 'juick-server/src/main/java/com/juick/server/api')
-rw-r--r-- | juick-server/src/main/java/com/juick/server/api/activity/Profile.java | 11 |
1 files changed, 8 insertions, 3 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 622bb08b..bbb7761f 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 @@ -6,16 +6,16 @@ import com.juick.server.KeystoreManager; import com.juick.server.SignatureManager; import com.juick.server.api.activity.model.*; import com.juick.server.api.activity.model.activities.Create; +import com.juick.server.api.activity.model.activities.Delete; import com.juick.server.api.activity.model.activities.Follow; import com.juick.server.api.activity.model.activities.Undo; import com.juick.server.util.HttpNotFoundException; import com.juick.server.util.UserUtils; import com.juick.service.MessagesService; import com.juick.service.UserService; +import com.juick.service.activities.DeleteUserEvent; import com.juick.service.activities.FollowEvent; import com.juick.service.activities.UndoFollowEvent; -import com.juick.util.MessageUtils; -import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.ApplicationEventPublisher; import org.springframework.http.HttpStatus; @@ -27,7 +27,6 @@ import org.springframework.web.util.UriComponentsBuilder; import javax.inject.Inject; import java.net.URI; -import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -249,6 +248,12 @@ public class Profile { applicationEventPublisher.publishEvent(new UndoFollowEvent(this, activity.getActor(), follower)); 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.NOT_IMPLEMENTED); } return new ResponseEntity<>(HttpStatus.UNAUTHORIZED); |