'Submit a new comment or reply to a message.
`parent` is the fullname of the thing being replied to. Its value
changes the kind of object created by this request:
* the fullname of a Link: a top-level comment in that Link\'s thread. (requires `submit` scope)
* the fullname of a Comment: a comment reply to that comment. (requires `submit` scope)
* the fullname of a Message: a message reply to that message. (requires `privatemessages` scope)
`text` should be the raw markdown body of the comment or message.
To start a new message thread, use [/api/compose](#POST_api_compose).'

@allow_oauth2_access
@validatedForm(VUser(), VModhash(), VRatelimit(rate_user=True, rate_ip=True, prefix='rate_comment_'), parent=VSubmitParent(['thing_id', 'parent']), comment=VMarkdownLength(['text', 'comment'], max_length=10000))
@api_doc(api_section.links_and_comments)
def POST_comment(self, commentform, jquery, parent, comment):

    should_ratelimit = True
    if isinstance(parent, Message):
        if (c.oauth_user and (not c.oauth_scope.has_any_scope({'privatemessages', 'submit'}))):
            abort(403, 'forbidden')
        if (not getattr(parent, 'repliable', True)):
            abort(403, 'forbidden')
        if (not parent.can_view_slow()):
            abort(403, 'forbidden')
        if (parent.sr_id and (not c.user_is_admin)):
            sr = parent.subreddit_slow
            if (sr.is_moderator(c.user) and (not c.user_is_admin)):
                muted_user = parent.get_muted_user_in_conversation()
                if muted_user:
                    c.errors.add(errors.MUTED_FROM_SUBREDDIT, field='parent')
                    g.events.muted_forbidden_event('muted    mod', sr, parent_message=parent, target=muted_user, request=request, context=c)
            elif sr.is_muted(c.user):
                c.errors.add(errors.USER_MUTED, field='parent')
                g.events.muted_forbidden_event('muted', parent_message=parent, target=sr, request=request, context=c)
        is_message = True
        should_ratelimit = False
    else:
        if (c.oauth_user and (not c.oauth_scope.has_access(c.site.name, {'submit'}))):
            abort(403, 'forbidden')
        is_message = False
        if isinstance(parent, Link):
            link = parent
            parent_comment = None
        else:
            link = Link._byID(parent.link_id)
            parent_comment = parent
        sr = Subreddit._byID(parent.sr_id, stale=True)
        is_author = (link.author_id == c.user._id)
        if ((is_author and (link.is_self or promote.is_promo(link))) or (not sr.should_ratelimit(c.user, 'comment'))):
            should_ratelimit = False
        hooks.get_hook('comment.validate').call(sr=sr, link=link, parent_comment=parent_comment)
    if (not should_ratelimit):
        c.errors.remove((errors.RATELIMIT, 'ratelimit'))
    if (commentform.has_errors('text', errors.NO_TEXT, errors.TOO_LONG) or commentform.has_errors('comment', errors.TOO_LONG) or commentform.has_errors('ratelimit', errors.RATELIMIT) or commentform.has_errors('parent', errors.DELETED_COMMENT, errors.TOO_OLD, errors.USER_BLOCKED, errors.USER_MUTED, errors.MUTED_FROM_SUBREDDIT, errors.THREAD_LOCKED)):
        return
    if is_message:
        if parent.from_sr:
            to = Subreddit._byID(parent.sr_id)
        else:
            to = Account._byID(parent.author_id)
        if to:
            sr_name = None
            if isinstance(to, Subreddit):
                sr_name = to.name
            elif (isinstance(to, Account) and parent and parent.sr_id):
                sr = Subreddit._byID(parent.sr_id, data=True)
                if sr:
                    sr_name = sr.name
            is_messaging_admins = (('/r/%s' % sr_name) == g.admin_message_acct)
            if (not (sr_name and is_messaging_admins)):
                VNotInTimeout().run(action_name='messagereply', target=parent)
        subject = parent.subject
        re = 're:    '
        if (not subject.startswith(re)):
            subject = (re + subject)
        (item, inbox_rel) = Message._new(c.user, to, subject, comment, request.ip, parent=parent)
    else:
        VNotInTimeout().run(action_name='comment', target=parent)
        (item, inbox_rel) = Comment._new(c.user, link, parent_comment, comment, request.ip)
    if is_message:
        queries.new_message(item, inbox_rel)
    else:
        queries.new_comment(item, inbox_rel)
    if should_ratelimit:
        VRatelimit.ratelimit(rate_user=True, rate_ip=True, prefix='rate_comment_')
    t = commentform.find('textarea')
    t.attr('rows', 3).html('').val('')
    if isinstance(parent, (Comment, Message)):
        commentform.remove()
        jquery.things(parent._fullname).set_text('.reply-button:first', _('replied'))
    jquery.insert_things(item)
    jquery('#noresults').hide()
