mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2025-01-11 17:55:37 +00:00
Fix create_review_from_activity.
This commit is contained in:
parent
9933dbba54
commit
ae191731dc
1 changed files with 4 additions and 2 deletions
|
@ -8,14 +8,16 @@ from fedireads.sanitize_html import InputHtmlParser
|
||||||
|
|
||||||
def create_review_from_activity(author, activity):
|
def create_review_from_activity(author, activity):
|
||||||
''' parse an activity json blob into a status '''
|
''' parse an activity json blob into a status '''
|
||||||
book = activity['inReplyToBook']
|
book_id = activity['inReplyToBook']
|
||||||
book = book.split('/')[-1]
|
book_id = book_id.split('/')[-1]
|
||||||
name = activity.get('name')
|
name = activity.get('name')
|
||||||
rating = activity.get('rating')
|
rating = activity.get('rating')
|
||||||
content = activity.get('content')
|
content = activity.get('content')
|
||||||
published = activity.get('published')
|
published = activity.get('published')
|
||||||
remote_id = activity['id']
|
remote_id = activity['id']
|
||||||
|
|
||||||
|
book = get_or_create_book(book_id)
|
||||||
|
|
||||||
review = create_review(author, book, name, content, rating)
|
review = create_review(author, book, name, content, rating)
|
||||||
review.published_date = published
|
review.published_date = published
|
||||||
review.remote_id = remote_id
|
review.remote_id = remote_id
|
||||||
|
|
Loading…
Reference in a new issue