示例#1
0
def generate_create_note(status: Status, users: List[UserProfile]) -> Create:

    note = status.to_activitystream()

    for user in users:
        note['cc'].append(user.ap_id)

    note['to'] += ['https://mstdn.io/users/yabirgb']

    t = Note(note)

    data = {
        'id': note['id'] + '/activity',
        'type': "Create",
        'actor': note['attributedTo'],
        'published': note['published'],
        'object': t,
    }

    if note.get('to'):
        data['to'] = note['to']

    if note.get('cc'):
        data['cc'] = note['cc']

    return Create(data)