From b2fe8b2ce6e8c59b93e19b714d7dc30e4f2d9965 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Sat, 23 Oct 2021 23:19:09 +0300 Subject: ActivityPub: handle unexpected Undo activity --- src/main/java/com/juick/www/api/activity/Profile.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/main/java') 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 26e2717c..e6a4e789 100644 --- a/src/main/java/com/juick/www/api/activity/Profile.java +++ b/src/main/java/com/juick/www/api/activity/Profile.java @@ -300,15 +300,15 @@ public class Profile { return new ResponseEntity<>(CommandResult.fromString("Follow request accepted"), HttpStatus.ACCEPTED); } if (activity instanceof Undo) { - Activity object = (Activity) activity.getObject(); + Context object = activity.getObject(); if (object instanceof Follow) { applicationEventPublisher - .publishEvent(new UndoFollowEvent(this, activity.getActor(), object.getObject().getId())); + .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(), object.getObject().getId())); + .publishEvent(new UndoAnnounceEvent(this, activity.getActor(), ((Activity)object).getObject().getId())); return new ResponseEntity<>(CommandResult.fromString("Undo like/announce request accepted"), HttpStatus.OK); } -- cgit v1.2.3