Example #1
0
def handle_incoming_add(activity):
    ''' someone is tagging or shelving a book '''
    if activity['object']['type'] == 'Tag':
        user = get_or_create_remote_user(activity['actor'])
        if not user.local:
            book = activity['target']['id'].split('/')[-1]
            create_tag(user, book, activity['object']['name'])
            return HttpResponse()
        return HttpResponse()
    return HttpResponseNotFound()
Example #2
0
def handle_tag(user, book, name):
    ''' tag a book '''
    tag = create_tag(user, book, name)
    tag_activity = activitypub.get_add_tag(tag)

    recipients = get_recipients(user, 'public')
    broadcast(user, tag_activity, recipients)
Example #3
0
def handle_tag(activity):
    ''' someone is tagging a book '''
    user = get_or_create_remote_user(activity['actor'])
    if not user.local:
        book = activity['target']['id']
        status_builder.create_tag(user, book, activity['object']['name'])
Example #4
0
def handle_tag(user, book, name):
    ''' tag a book '''
    tag = create_tag(user, book, name)
    tag_activity = activitypub.get_add_tag(tag)

    broadcast(user, tag_activity)