Adds commenting

works on #59
This commit is contained in:
Mouse Reeve
2020-03-21 16:50:49 -07:00
parent 3f96c8cd9d
commit 7862af9729
16 changed files with 222 additions and 31 deletions

View File

@ -12,6 +12,15 @@ def get_review(review):
return status
def get_comment(comment):
''' fedireads json for book reviews '''
status = get_status(comment)
status['inReplyToBook'] = comment.book.absolute_id
status['fedireadsType'] = comment.status_type
status['name'] = comment.name
return status
def get_review_article(review):
''' a book review formatted for a non-fedireads isntance (mastodon) '''
status = get_status(review)
@ -24,6 +33,17 @@ def get_review_article(review):
return status
def get_comment_article(comment):
''' a book comment formatted for a non-fedireads isntance (mastodon) '''
status = get_status(comment)
name = '%s (comment on "%s")' % (
comment.name,
comment.book.title
)
status['name'] = name
return status
def get_status(status):
''' create activitypub json for a status '''
user = status.user