Пример #1
0
def patch_is_unapproved(request, thread, value):
    allow_approve_thread(request.user, thread)

    if value:
        raise PermissionDenied(_("Content approval can't be reversed."))

    moderation.approve_thread(request, thread)

    return {
        'is_unapproved': thread.is_unapproved,
        'has_unapproved_posts': thread.has_unapproved_posts,
    }
Пример #2
0
def patch_is_unapproved(request, thread, value):
    allow_approve_thread(request.user, thread)

    if value:
        raise PermissionDenied(_("Content approval can't be reversed."))

    moderation.approve_thread(request, thread)

    return {
        'is_unapproved': thread.is_unapproved,
        'has_unapproved_posts': thread.has_unapproved_posts,
    }
Пример #3
0
def patch_is_unapproved(request, thread, value):
    if thread.acl.get('can_approve'):
        if value:
            raise PermissionDenied(_("Content approval can't be reversed."))

        moderation.approve_thread(request, thread)

        return {
            'is_unapproved': thread.is_unapproved,
            'has_unapproved_posts': thread.has_unapproved_posts,
        }
    else:
        raise PermissionDenied(_("You don't have permission to approve this thread."))
Пример #4
0
def patch_is_unapproved(request, thread, value):
    if thread.acl.get('can_approve'):
        if value:
            raise PermissionDenied(_("Content approval can't be reversed."))

        moderation.approve_thread(request.user, thread)

        return {
            'is_unapproved': thread.is_unapproved,
            'has_unapproved_posts': thread.has_unapproved_posts,
        }
    else:
        raise PermissionDenied(
            _("You don't have permission to approve this thread."))