1
0
Fork 0

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

@ -1,8 +1,12 @@
''' bring activitypub functions into the namespace '''
from .actor import get_actor
from .collection import get_outbox, get_outbox_page, get_add, get_remove, \
get_following, get_followers
from .collection import get_outbox, get_outbox_page
from .collection import get_add, get_remove
from .collection import get_following, get_followers
from .create import get_create
from .follow import get_follow_request, get_unfollow, get_accept, get_reject
from .status import get_review, get_review_article, get_status, get_replies, \
get_favorite, get_unfavorite, get_add_tag, get_remove_tag, get_replies_page
from .status import get_review, get_review_article
from .status import get_comment, get_comment_article
from .status import get_status, get_replies, get_replies_page
from .status import get_favorite, get_unfavorite
from .status import get_add_tag, get_remove_tag

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