Exemplo n.º 1
0
def federate_delete_sound(sound: Sound) -> None:
    actor = sound.user.actor[0].to_dict()
    # Get activity
    # Create delete
    # Somehow we needs to add /activity here
    # FIXME do that better
    delete = ap.Delete(actor=actor,
                       object=ap.Tombstone(id=sound.activity.payload["id"] +
                                           "/activity").to_dict(embed=True))
    # Federate
    post_to_outbox(delete)
Exemplo n.º 2
0
def federate_delete_actor(actor: Actor) -> None:
    # TODO FIXME: to who is the delete sent ?

    actor = actor.to_dict()
    # Create delete
    # No need for '/activity' here ?
    # FIXME do that better
    delete = ap.Delete(actor=actor,
                       object=ap.Tombstone(id=actor["id"]).to_dict(embed=True))
    # Federate
    post_to_outbox(delete)
Exemplo n.º 3
0
def federate_delete_actor(actor: Actor) -> None:
    # TODO FIXME: to who is the delete sent ?

    actor = actor.to_dict()
    # Create delete
    # No need for '/activity' here ?
    # FIXME do that better
    to = [follower.actor.url for follower in actor.followers]
    to.append(ap.AS_PUBLIC)
    delete = ap.Delete(to=to,
                       actor=actor,
                       object=ap.Tombstone(id=actor["id"]).to_dict(embed=True))
    # Federate
    post_to_outbox(delete)
Exemplo n.º 4
0
def api_delete() -> _Response:
    """API endpoint to delete a Note activity."""
    note = _user_api_get_note(from_outbox=True)

    # Create the delete, same audience as the Create object
    delete = ap.Delete(
        actor=ID,
        object=ap.Tombstone(id=note.id).to_dict(embed=True),
        to=note.to,
        cc=note.cc,
        published=now(),
    )

    delete_id = post_to_outbox(delete)

    return _user_api_response(activity=delete_id)
Exemplo n.º 5
0
def federate_delete_sound(sound: Sound) -> None:
    if not current_app.config["AP_ENABLED"]:
        return

    # TODO FIXME: to who is the delete sent ?

    actor = sound.user.actor[0].to_dict()
    # Get activity
    # Create delete
    # Somehow we needs to add /activity here
    # FIXME do that better
    if not sound.activity:
        # track never federated
        return
    delete = ap.Delete(actor=actor,
                       object=ap.Tombstone(id=sound.activity.payload["id"] +
                                           "/activity").to_dict(embed=True))
    # Federate
    post_to_outbox(delete)
Exemplo n.º 6
0
def federate_delete_sound(sound: Sound) -> None:
    if not current_app.config["AP_ENABLED"]:
        return

    # TODO FIXME: to who is the delete sent ?

    actor = sound.user.actor[0]
    # Get activity
    # Create delete
    # Somehow we needs to add /activity here
    # FIXME do that better
    if not sound.activity:
        # track never federated
        return
    to = [follower.actor.url for follower in actor.followers]
    to.append(ap.AS_PUBLIC)
    delete = ap.Delete(
        to=to,
        actor=actor.to_dict(),
        object=ap.Tombstone(id=sound.activity.payload["id"] +
                            "/activity").to_dict(embed=True),
    )
    # Federate
    post_to_outbox(delete)