foobuzz

by Valentin, December 5 2015, in random

The np problem, Reddit edition

Have you ever been redirected to a so-called read-only version of Reddit? That's a thing. For example, check out np.reddit.com/r/books. No voting arrows, no button to comment even when logged in, and a little message at the top of the subreddit: "You have been linked to a read-only version of this subreddit. Please respect the community by not voting." All because the little np ("No Participation") subdomain was used. Now if you try the same thing with /r/askreddit: np.reddit.com/r/askreddit, everything is absolutely normal, no difference with the regular Reddit. Quite strange, isn't it. It doesn't stop there. For example, sf.reddit.com/r/teenagers displays only the self-post of the subreddit, because of the sf (SelF-posts) subdomain. But that only works for /r/teenagers. So, what the well?

How Reddit subdomains work

One good thing about reddit is that it's open-source. So one can inspect the code related to subdomains handling to understand how it works. I did read the code, and this is what I discovered.

Reddit accepts subdomains that indicates the language with which the site should be displayed. What's interesting is that Reddit doesn't have a predefined list of strings that are accepted as a language subdomain, but uses a regular expression instead: \A\w\w(-\w\w)?\Z. So, basically, any sequence of two alphanumerical characters, optionally followed by a dash and another such sequence is accepted. For example, zz or an-42 are valid language subdomains, even though they correspond to no language code in the ISO 639-1 specification.

What does Reddit do with such code? Well, for some real languages such as French (fr) or Japanese (ja), the web interface is actually translated into the language. For the more esoteric codes that I invented in the paragraph above, it does nothing to the interface. However, for any given code, it performs one thing: in the HTML of the web page, it sets the value of the lang attribute of the html root tag to the code provided. So, when you browse to an-42.reddit.com, the HTML source of the page starts with:

<!doctype html><html xmlns="http://www.w3.org/1999/xhtml" lang="an-42" xml:lang="an-42">

Using and abusing CSS

On Reddit, despite doing the hard and benevolent work of maintaining subreddits, moderators have only access to quite rudimentary tools. Actually the improvement of moderator tools is always brought to the table when the admins risk themselves into asking the community for feedback. This issue was critical when last summer reddit let go the employee in charge of the relations between the moderators of /r/IamA and the celebrities doing interviews, all without warning the moderators, generating a massive reddit-wide drama.

Anyway, it's a matter of fact that there are no moderator tools to customize the user experience depending on the subdomain used, nor tools to add custom modules or text areas anywhere in the subreddit page. However, the moderators have access to one thing: they can edit the CSS stylesheet used to render the subreddit. And that's the key to everything. CSS is like editing in film-making; no matter what material you have, you can transform it into whatever you want. CSS is power.

The basic idea is that if you prefix some CSS rules with the body:lang(np) selector, the rule will only apply to pages whose html tag have their lang attribute set to np. So, as a Reddit moderator, you can effectively define rules for specific subdomains. You can then use the power of CSS to fully customize the page for this subdomain. You can, especially, make things disappear using the display: none property:

body:lang(np) .usertext-edit,
body:lang(np) .sidebox.submit,
body:lang(np) .commentingAs,
body:lang(np) .markdownEditor, 
body:lang(np) a[onclick*="return reply(this)"],
body:lang(np) .helplink
{
    display: none !important;
}

Additionally, you can make new things appear using the content CSS property coupled with the :before or :after selector:

body:lang(np) #siteTable:before
{
    content: "You have been linked to a read-only version of this subreddit. Please respect the community by not voting.";
    display: block;
    max-width: 800px;
    background-color: #F6E69F;
    padding: 5px 10px;
    margin: 5px 305px 5px 0px;
    border: 1px solid orange;
    font-size: small;
}

A drawback of adding content using this method is that the inserted text is not selectable. This can be frustrating from a user-experience point of view.

The code snippets provided above come from the actual stylesheet provided by the /r/NoParticipation subreddit, which is dedicated to instruct moderators on how to "install" the "No Participation mode" on their own subreddits. In the next part, I explain how such a subreddit was born and why moderators would want to add a "No Participation mode" to their subreddit.

Combating cross-subreddit contamination with the No Participation mode

There are such things known as the meta subreddits. On such subreddits, users share links and comment about what happen on Reddit. For example, /r/BestOf is for comments which are awesome in some way and which constitutes the "best of" Reddit. /r/ThreadKillers is for comments which answer a question or a request in such a comprehensive way that any additional comment from other users is not necessary. /r/DepthHub is for comments which answer a question in depth. /r/SubredditDrama is for following flame-wars going on Reddit.

The subreddits these meta-subreddits link to sometimes are little subreddits or even niche subreddits, for example dedicated to specific hobbies. The problem is that meta-subreddits' users, instead of just being spectators of what's happening on Reddit, would sometimes go on and enter the show, voting on comments of the thread linked, posting comments themselves and so on. On top of disrupting the normal flow of upvotes and downvotes and disrespect the explicit and implicit submission guidelines of the subreddits they were showing up in, users would sometimes perform vote brigading, that is, massively downvoting a opinion they disagree with so that it would be buried in the abyss of the comments and become invisible.

To combat this problem, redditor /u/KortoloB had an idea. He figured out the technical elements explained in the previous part and wrote a "no participation" stylesheet dedicated to the np subdomain. This is the stylesheet which contain the snippets presented in the previous part. He created the subreddit /r/NoParticipation to host and support his idea. He abstracted the technical working of the stylesheet into what he calls the No Participation mode and wrote instruction on how to install the No Participation mode on one's subreddit (basically instructing to copy and paste the stylesheet).

To make /u/KortoloB's idea work reddit-wide, there were two additional conditions: that regular subreddits install the No Participation Mode, and that the meta subreddits' submissions point to the No Participation mode of other subreddits. I don't know the exact time-line of events, but as of today, the NP mode is deployed on a lot of subreddits and the system works pretty well. This page lists all the subreddits that have No Participation installed, as well as meta-subreddits that instruct users to only post links pointing to the NP version of a subreddit, some of them requiring it (i.e. removing posts that don't respect the rule).

Reaction of the community and of the reddit staff

My impression as a regular redditor is that the No Participation thing caused and is still causing a lot of confusion in the Reddit community.

Most redditors know that moderators tools a quite limited and seeing voting arrows disappearing depending on the subdomain in the URL gives them the impression that the No Participation mode must be some kind of official Reddit feature. Furthermore, to even more discourage users to participate in the No Participation mode, some moderators launched the rumor that removing the np subdomain and reloading the page to participate would result in them being banned. However, moderators have no way to detect such behavior and admins have nothing to do with the No Participation mode. Technically, you don't even have to reload the page to participate, but just to disable the styles defined by the moderators. Since Reddit delivers the moderator stylesheet as a separate CSS file upon a client request, it's fairly easy with any browser's development tools to disable only the moderators styles.

When confused users would ask in several threads what the hell the No Participation mode was, some would answer by only giving a few bullet points about what this mode changed, in a tone that would validate the false idea that it's an official reddit feature. Some other would accurately explain that it's nothing more than a hack from the moderators that exploit the np language subdomain. Some would let think that moderators have a direct tool to customize a subreddit depending on the language, not clarifying that elements of the page are still there but just hidden. Fortunately, some other would accurately explain that it's a CSS hack.

A rumor that became popular is that the np language subdomain is for the Nepalese version of Reddit. In fact, the Nepalese language code is ne, not np (the location code of Nepal is NP, but Reddit's subdomain are not made for locations code). Furthermore, as explained in the first part of this article, Reddit accept any combination of two letters as the language subdomain. np corresponds to no language according to the ISO standard.

In the 2014 thread about the Reddit official blogpost How reddit works, when a user asked about the No Participation mode, the admin /u/cupcake1713 clarified that it wasn't actually something from the Reddit staff and called it a "crappy CSS hack" (and stroke the "crappy" out later, probably by remorse after No Participation creator answered to her comment and said being a little bit affected that his idea was denigrated so much by the admins). She also pointed out that the admins realized quite recently (relatively to the date of her comment) that the NP stylesheet was hiding the "report" button on submissions (a button to report abuse), that this was a "huge problem" and that if the staff would have spotted this problem sooner they would have stop the spread of this thing. The no participation stylesheet is since fixed and doesn't hide the report button.

Since then, other subreddits have customized other subdomains for other purposes (cf. sf on /r/teenagers for showing only self-posts). Last summer, admins said that they'll deploy better moderation tools by 2016. My bet is that it won't include any non-participation related stuff. It's too easy to override and it probably wouldn't scale well. I just want moderators to be able to add custom text boxes in the page without CSS so that the text is selectable. There's something deeply wrong with non-selectable text.