Beispiel #1
0
def handle_unboost(activity):
    ''' someone gave us a boost! '''
    boost = models.Boost.objects.filter(
        remote_id=activity['object']['id']
    ).first()
    if boost:
        status_builder.delete_status(boost)
Beispiel #2
0
def handle_delete_status(activity):
    ''' remove a status '''
    status_id = activity['object']['id']
    try:
        status = models.Status.objects.select_subclasses().get(
            remote_id=status_id)
    except models.Status.DoesNotExist:
        return
    status_builder.delete_status(status)
Beispiel #3
0
    def post(self, request, status_id):
        ''' delete and tombstone a status '''
        status = get_object_or_404(models.Status, id=status_id)

        # don't let people delete other people's statuses
        if status.user != request.user:
            return HttpResponseBadRequest()

        # perform deletion
        delete_status(status)
        return redirect(request.headers.get('Referer', '/'))
Beispiel #4
0
    def post(self, request, status_id):
        """ delete and tombstone a status """
        status = get_object_or_404(models.Status, id=status_id)

        # don't let people delete other people's statuses
        if status.user != request.user and not request.user.has_perm(
                "moderate_post"):
            return HttpResponseBadRequest()

        # perform deletion
        delete_status(status)
        return redirect(request.headers.get("Referer", "/"))
Beispiel #5
0
def handle_delete_status(activity):
    ''' remove a status '''
    try:
        status_id = activity['object']['id']
    except TypeError:
        # this isn't a great fix, because you hit this when mastadon
        # is trying to delete a user.
        return
    try:
        status = models.Status.objects.get(remote_id=status_id)
    except models.Status.DoesNotExist:
        return
    models.Notification.objects.filter(related_status=status).all().delete()
    status_builder.delete_status(status)
Beispiel #6
0
def handle_delete_status(activity):
    ''' remove a status '''
    try:
        status_id = activity['object']['id']
    except TypeError:
        # this isn't a great fix, because you hit this when mastadon
        # is trying to delete a user.
        return
    try:
        status = models.Status.objects.select_subclasses().get(
            remote_id=status_id)
    except models.Status.DoesNotExist:
        return
    status_builder.delete_status(status)
Beispiel #7
0
def handle_delete_status(user, status):
    ''' delete a status and broadcast deletion to other servers '''
    delete_status(status)
    broadcast(user, status.to_delete_activity(user))