'Set or unset "contest mode" for a link\'s comments.
`state` is a boolean that indicates whether you are enabling or
disabling contest mode - true to enable, false to disable.'

@require_oauth2_scope('modposts')
@validatedForm(VUser(), VModhash(), VSrCanBan('id'), thing=VByName('id'), state=VBoolean('state'), timeout=VNotInTimeout('id'))
@api_doc(api_section.links_and_comments)
def POST_set_contest_mode(self, form, jquery, thing, state, timeout):

    thing.contest_mode = state
    thing._commit()
    if state:
        action = 'setcontestmode'
    else:
        action = 'unsetcontestmode'
    ModAction.create(thing.subreddit_slow, c.user, action, target=thing)
    jquery.refresh()
