forked from mirrors/bookwyrm
Fixes duplicate save attempt of review
This commit is contained in:
parent
cc1f222431
commit
f414884e00
2 changed files with 7 additions and 17 deletions
|
@ -303,9 +303,8 @@ def handle_incoming_create(activity):
|
||||||
'inReplyTo' in activity['object']:
|
'inReplyTo' in activity['object']:
|
||||||
response = create_review(user, activity)
|
response = create_review(user, activity)
|
||||||
|
|
||||||
if not user.local:
|
|
||||||
models.Activity(
|
models.Activity(
|
||||||
uuid=activity['uuid'],
|
uuid=activity['id'],
|
||||||
user=user,
|
user=user,
|
||||||
content=activity,
|
content=activity,
|
||||||
activity_type=activity['object']['type']
|
activity_type=activity['object']['type']
|
||||||
|
|
|
@ -205,6 +205,7 @@ def handle_review(user, book, name, content, rating):
|
||||||
'type': 'Article',
|
'type': 'Article',
|
||||||
'published': datetime.utcnow().isoformat(),
|
'published': datetime.utcnow().isoformat(),
|
||||||
'attributedTo': user.actor,
|
'attributedTo': user.actor,
|
||||||
|
'name': name,
|
||||||
'content': content,
|
'content': content,
|
||||||
'inReplyTo': book.openlibrary_key, # TODO is this the right identifier?
|
'inReplyTo': book.openlibrary_key, # TODO is this the right identifier?
|
||||||
'rating': rating, # fedireads-only custom field
|
'rating': rating, # fedireads-only custom field
|
||||||
|
@ -226,15 +227,5 @@ def handle_review(user, book, name, content, rating):
|
||||||
'object': obj,
|
'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)
|
broadcast(user, activity, recipients)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue