def patch_is_hidden(request, thread, value): if value: allow_hide_thread(request.user, thread) moderation.hide_thread(request, thread) else: allow_unhide_thread(request.user, thread) moderation.unhide_thread(request, thread) return {'is_hidden': thread.is_hidden}