Esempio n. 1
0
def handle_review(user, book, name, content, rating):
    ''' post a review '''
    # validated and saves the review in the database so it has an id
    review = create_review(user, book, name, content, rating)

    review_activity = activitypub.get_review(review)
    review_create_activity = activitypub.get_create(user, review_activity)
    fr_recipients = get_recipients(user, 'public', limit='fedireads')
    broadcast(user, review_create_activity, fr_recipients)

    # re-format the activity for non-fedireads servers
    article_activity = activitypub.get_review_article(review)
    article_create_activity = activitypub.get_create(user, article_activity)

    other_recipients = get_recipients(user, 'public', limit='other')
    broadcast(user, article_create_activity, other_recipients)
Esempio n. 2
0
 def activitypub_serialize(self):
     return activitypub.get_review(self)