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, }
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, }
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."))
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."))