'Delete a Link or Comment.'

@require_oauth2_scope('edit')
@noresponse(VUser(), VModhash(), thing=VByNameIfAuthor('id'))
@api_doc(api_section.links_and_comments)
def POST_del(self, thing):

    if (not thing):
        return
    was_deleted = thing._deleted
    thing._deleted = True
    if ((getattr(thing, 'promoted', None) is not None) and (not promote.is_promoted(thing))):
        promote.reject_promotion(thing)
    thing._commit()
    thing.update_search_index()
    if isinstance(thing, Link):
        amqp.add_item('deleted_link', thing._fullname)
        queries.delete(thing)
        thing.subreddit_slow.remove_sticky(thing)
        if thing.preview_object:
            thing.set_preview_object(None)
            thing._commit()
    elif isinstance(thing, Comment):
        link = thing.link_slow
        if (not was_deleted):
            lock_key = 'lock:del_{link}_{comment}'.format(link=link._id36, comment=thing._id36)
            if g.lock_cache.add(lock_key, '', time=60):
                link._incr('num_comments', (-1))
        link.remove_sticky_comment(comment=thing, set_by=c.user)
        queries.new_comment(thing, None)
        queries.unnotify(thing)
        amqp.add_item('deleted_comment', thing._fullname)
        queries.delete(thing)
