'Subscribe to or unsubscribe from a subreddit.
To subscribe, `action` should be `sub`. To unsubscribe, `action` should
be `unsub`. The user must have access to the subreddit to be able to
subscribe to it.
See also: [/subreddits/mine/](#GET_subreddits_mine_{where}).'

@require_oauth2_scope('subscribe')
@noresponse(VUser(), VModhash(), action=VOneOf('action', ('sub', 'unsub')), sr=VSubscribeSR('sr', 'sr_name'))
@api_doc(api_section.subreddits)
def POST_subscribe(self, action, sr):

    if (not sr):
        return abort(404, 'not    found')
    elif ((action == 'sub') and (not sr.can_view(c.user))):
        return abort(403, 'permission    denied')
    elif isinstance(sr, FakeSubreddit):
        return abort(403, 'permission    denied')
    Subreddit.subscribe_defaults(c.user)
    if (action == 'sub'):
        SubredditParticipationByAccount.mark_participated(c.user, sr)
        if (not sr.is_subscriber(c.user)):
            sr.add_subscriber(c.user)
    elif sr.is_subscriber(c.user):
        sr.remove_subscriber(c.user)
    else:
        return abort(404, 'not    found')
    sr.update_search_index(boost_only=True)
