diff options
author | Vitaly Takmazov | 2021-10-24 05:54:06 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2021-10-24 05:54:06 +0300 |
commit | ae4fd85c07755c3b67d1106cd570941be5c20a75 (patch) | |
tree | 9e1809c40b96ce94f1e884d6912bc6158a99aa3d /src/main/java/com/juick/www/api/activity | |
parent | 06ad05137bdae937c6c23b02e8bf3265db52ff36 (diff) |
ActivityPub: accept profile updates
Diffstat (limited to 'src/main/java/com/juick/www/api/activity')
-rw-r--r-- | src/main/java/com/juick/www/api/activity/Profile.java | 16 |
1 files changed, 12 insertions, 4 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 8a879f3b..495ca8f9 100644 --- a/src/main/java/com/juick/www/api/activity/Profile.java +++ b/src/main/java/com/juick/www/api/activity/Profile.java @@ -34,6 +34,7 @@ import com.juick.www.api.activity.model.activities.Flag; import com.juick.www.api.activity.model.activities.Follow; import com.juick.www.api.activity.model.activities.Like; import com.juick.www.api.activity.model.activities.Undo; +import com.juick.www.api.activity.model.activities.Update; import com.juick.www.api.activity.model.objects.Actor; import com.juick.www.api.activity.model.objects.Application; import com.juick.www.api.activity.model.objects.Image; @@ -302,13 +303,13 @@ public class Profile { if (activity instanceof Undo) { Context object = activity.getObject(); if (object instanceof Follow) { - applicationEventPublisher - .publishEvent(new UndoFollowEvent(this, activity.getActor(), ((Activity)object).getObject().getId())); + applicationEventPublisher.publishEvent( + new UndoFollowEvent(this, activity.getActor(), ((Activity) object).getObject().getId())); return new ResponseEntity<>(CommandResult.fromString("Undo follow request accepted"), HttpStatus.OK); } else if (object instanceof Like || object instanceof Announce) { - applicationEventPublisher - .publishEvent(new UndoAnnounceEvent(this, activity.getActor(), ((Activity)object).getObject().getId())); + applicationEventPublisher.publishEvent( + new UndoAnnounceEvent(this, activity.getActor(), ((Activity) object).getObject().getId())); return new ResponseEntity<>(CommandResult.fromString("Undo like/announce request accepted"), HttpStatus.OK); } @@ -401,6 +402,13 @@ public class Profile { logger.info("{} flag some objects: {}", actor, activity.getObject()); return new ResponseEntity<>(CommandResult.fromString("Report accepted"), HttpStatus.ACCEPTED); } + if (activity instanceof Update) { + if (activity.getObject() instanceof Person + && activity.getActor().equals(activity.getObject().getId())) { + logger.info("{} update they profile"); + return new ResponseEntity<>(CommandResult.fromString("Update accepted"), HttpStatus.ACCEPTED); + } + } logger.warn("Unknown activity: {}", jsonMapper.writeValueAsString(activity)); return new ResponseEntity<>(CommandResult.fromString("Unknown activity"), HttpStatus.NOT_IMPLEMENTED); } |