Fixes duplicate save attempt of review

This commit is contained in:
Mouse Reeve 2020-02-14 21:15:38 -08:00
parent cc1f222431
commit f414884e00
2 changed files with 7 additions and 17 deletions

View file

@ -303,9 +303,8 @@ def handle_incoming_create(activity):
'inReplyTo' in activity['object']:
response = create_review(user, activity)
if not user.local:
models.Activity(
uuid=activity['uuid'],
uuid=activity['id'],
user=user,
content=activity,
activity_type=activity['object']['type']

View file

@ -205,6 +205,7 @@ def handle_review(user, book, name, content, rating):
'type': 'Article',
'published': datetime.utcnow().isoformat(),
'attributedTo': user.actor,
'name': name,
'content': content,
'inReplyTo': book.openlibrary_key, # TODO is this the right identifier?
'rating': rating, # fedireads-only custom field
@ -226,15 +227,5 @@ def handle_review(user, book, name, content, rating):
'object': obj,
}
models.Review(
uuid=create_uuid,
user=user,
content=activity,
activity_type='Article',
book=book,
name=name,
rating=rating,
review_content=content,
).save()
broadcast(user, activity, recipients)