Deduplicate incoming Create notes

This commit is contained in:
Mouse Reeve 2020-11-04 15:23:52 -08:00
parent 722f44ac9f
commit 21c0a0163a
2 changed files with 5 additions and 1 deletions

View file

@ -217,6 +217,10 @@ def handle_create(activity):
return
# render the json into an activity object
status_id = activity['object']['id']
if models.Status.objects.filter(remote_id=status_id).count():
return
serializer = activitypub.activity_objects[activity['object']['type']]
activity = serializer(**activity['object'])

View file

@ -76,8 +76,8 @@ class Status(OrderedCollectionPageMixin, BookWyrmModel):
return tags
shared_mappings = [
ActivityMapping('id', 'remote_id'),
ActivityMapping('url', 'remote_id'),
ActivityMapping('id', 'remote_id'),
ActivityMapping('inReplyTo', 'reply_parent'),
ActivityMapping('published', 'published_date'),
ActivityMapping('attributedTo', 'user'),