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,13 +303,12 @@ def handle_incoming_create(activity):
|
|||
'inReplyTo' in activity['object']:
|
||||
response = create_review(user, activity)
|
||||
|
||||
if not user.local:
|
||||
models.Activity(
|
||||
uuid=activity['uuid'],
|
||||
user=user,
|
||||
content=activity,
|
||||
activity_type=activity['object']['type']
|
||||
)
|
||||
models.Activity(
|
||||
uuid=activity['id'],
|
||||
user=user,
|
||||
content=activity,
|
||||
activity_type=activity['object']['type']
|
||||
)
|
||||
return response
|
||||
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
Loading…
Reference in a new issue