diff options
author | Vitaly Takmazov | 2023-01-04 16:24:47 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2023-01-04 16:24:47 +0300 |
commit | 58359b1e45861fea725aa7accfe5879d2d7fbeb7 (patch) | |
tree | 5ca10dedef14cd1f79a3047b2a862dfaaa018ec4 /src/main/java/com/juick/www/api/activity | |
parent | 6d74934d18f345f2ffcbc219d13dd63a2f0b9810 (diff) |
ActivityPub: fix actor to user conversion, handle Block activity
Diffstat (limited to 'src/main/java/com/juick/www/api/activity')
-rw-r--r-- | src/main/java/com/juick/www/api/activity/Profile.java | 9 |
1 files changed, 7 insertions, 2 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 4dcd4910..d2468d70 100644 --- a/src/main/java/com/juick/www/api/activity/Profile.java +++ b/src/main/java/com/juick/www/api/activity/Profile.java @@ -17,6 +17,7 @@ package com.juick.www.api.activity; +import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.juick.model.Message; import com.juick.model.User; @@ -28,6 +29,7 @@ import com.juick.www.api.activity.helpers.ProfileUriBuilder; import com.juick.www.api.activity.model.Activity; import com.juick.www.api.activity.model.Context; import com.juick.www.api.activity.model.activities.Announce; +import com.juick.www.api.activity.model.activities.Block; import com.juick.www.api.activity.model.activities.Create; import com.juick.www.api.activity.model.activities.Delete; import com.juick.www.api.activity.model.activities.Flag; @@ -40,6 +42,7 @@ import com.juick.www.api.activity.model.objects.Note; import com.juick.www.api.activity.model.objects.OrderedCollection; import com.juick.www.api.activity.model.objects.OrderedCollectionPage; import com.juick.www.api.activity.model.objects.Person; +import com.juick.util.HttpBadRequestException; import com.juick.util.HttpNotFoundException; import com.juick.service.MessagesService; import com.juick.service.UserService; @@ -70,7 +73,6 @@ import java.net.URI; import java.nio.charset.StandardCharsets; import java.util.List; import java.util.NoSuchElementException; -import java.util.stream.Collectors; import java.util.stream.Stream; @RestController @@ -405,6 +407,9 @@ public class Profile { } } } + if (activity instanceof Block) { + logger.info("{} blocks {} (room_full_of_people_who_care.jpg)", activity.getActor(), activity.getObject().getId()); + } logger.warn("Unknown activity: {}", jsonMapper.writeValueAsString(activity)); return new ResponseEntity<>(CommandResult.fromString("Unknown activity"), HttpStatus.NOT_IMPLEMENTED); } @@ -418,7 +423,7 @@ public class Profile { } @PostMapping(value = { "/u/", "/api/u/" }, produces = MediaType.APPLICATION_JSON_VALUE) - public User fetchUser(@RequestParam URI uri) { + public User fetchUser(@RequestParam URI uri) throws JsonProcessingException, HttpBadRequestException { return activityPubManager.actorToUser(uri); } } |