|
6 | 6 | import smithereen.activitypub.ActivityForwardingUtils; |
7 | 7 | import smithereen.activitypub.ActivityHandlerContext; |
8 | 8 | import smithereen.activitypub.ActivityTypeHandler; |
9 | | -import smithereen.activitypub.objects.ForeignActor; |
10 | 9 | import smithereen.activitypub.objects.NoteOrQuestion; |
11 | 10 | import smithereen.activitypub.objects.activities.Update; |
| 11 | +import smithereen.exceptions.ObjectNotFoundException; |
12 | 12 | import smithereen.model.ForeignUser; |
13 | | -import smithereen.model.OwnerAndAuthor; |
| 13 | +import smithereen.model.MailMessage; |
14 | 14 | import smithereen.model.Post; |
15 | | -import smithereen.exceptions.ObjectNotFoundException; |
16 | 15 | import smithereen.model.comments.Comment; |
17 | | -import smithereen.model.comments.CommentableContentObject; |
| 16 | +import smithereen.storage.MailStorage; |
18 | 17 | import smithereen.storage.PostStorage; |
19 | 18 |
|
20 | 19 | public class UpdateNoteHandler extends ActivityTypeHandler<ForeignUser, Update, NoteOrQuestion>{ |
@@ -60,6 +59,11 @@ public void handle(ActivityHandlerContext context, ForeignUser actor, Update act |
60 | 59 | context.appContext.getWallController().loadAndPreprocessRemotePostMentions(updated, post); |
61 | 60 | context.appContext.getCommentsController().putOrUpdateForeignComment(updated); |
62 | 61 | ActivityForwardingUtils.forwardCommentInteraction(context, updated); |
| 62 | + }else if(existing instanceof MailMessage existingMessage){ |
| 63 | + MailMessage updated=post.asNativeMessage(context.appContext); |
| 64 | + if(updated.senderID!=existingMessage.senderID || actor.id!=existingMessage.senderID) |
| 65 | + throw new IllegalArgumentException("No access to update this message"); |
| 66 | + MailStorage.updateForeignMessage(updated, true); |
63 | 67 | } |
64 | 68 | } |
65 | 69 | } |
0 commit comments