An approve action should only trigger on a reported item if the rule was specifically looking for it being reported. Previously, any rule with an approve action could end up triggering on an item when it was re-checked due to a report.
This fixes a KeyError that occurs when pref_other_theme isn't passed in.
When the safe search feature is enabled, NSFW links and subreddits will not appear in search results unless the over18 preference has been set by the user. For easy access to the over18 preference, add a link to enable NSFW search results on the main search page and the subreddit search page. Clicking on the link will redirect to the /over18 confirmation page. The link will not appear if the over18 preference was already enabled.
This was leading to strange behaviour like `<$>timesince</$>` in a random string field rending as `just now`. It might have been necessary when we were caching `JsonTemplate`s, but we don't anymore.
Having the import here means we can't import anything from `filters` with a clean build environment. `wrapped` won't exist yet, and we need `scriptsafe_dumps` for the JS build!
This fixes an issue with `/user/me/snoo` since `/user/:name/snoo` is defined in `-gold`.
This fixes an issue where we were parsing `request.cookies` before checking if the cookie header was even valid: https://github.com/reddit/reddit/blob/86a3d262f20c7ac457db089288925c88792e9b1e/r2/r2/controllers/reddit_base.py#L1477 This lead to a lot of hard-to-track down issues like us ending up in `<Controller.post>` with inconsistent state due to `pre` aborting. Before we were throwing them out in `RedditController.pre`, but we need `request.cookies` in `MinimalController.pre` as well: https://github.com/reddit/reddit/blob/86a3d262f20c7ac457db089288925c88792e9b1e/r2/r2/controllers/reddit_base.py#L1099 Since `RedditController.pre` uses `request.cookies` before calling `MinimalController.pre`, I took the easy route and put the header cleaning code in `BaseController.__before__`, before either `pre` gets run.
In certain cases, we'll try to load in comments for which we can't find a cached sort value. When that happens, we calculate the value on-the-fly and then store it. When this happens, we've been pulling the comment without any of its extra attributes. This is fine for most sorts, but for the Q&A sort, we look at more than just the ups and downs (notably, `author_id`). Since we weren't getting these attributes, we'd run into an error when trying to use them. Now we fetch the extra data for comments when using the Q&A sort.
With the reddit themes release, the default sr style and header overrides the subreddit style if there is no stylesheet (even if there is a header). This change considers a header as being part of the style and won't override the current sr style for the reason of there being no stylesheet. This header image can be disabled with the "show this subreddit's theme" toggle.
Because www2 should be stripped from www2.foo.com but not from www2.com
While most of the time two urls with identical query parameters in a different order are treated exactly the same by the receiving server, every now and then they're not. Now we use `OrderedDict`s for storing the query params, allowing us to deal with those situations.
They'd always end up as strings eventually when you `unparse()`, but storing them as non-strings throws off `__eq__()`.
While investigating one issue I got distracted by another issue with the newly-written `__eq__` method of `UrlParser`, which in turn got me frustrated with the `_url_updates` attribute. You see, after parsing a url into a `UrlParser`, we've been keeping the original url parameters in `_query_dict`, updates to it in `_url_updates`, and merging them together on `unparse()`. At first glance, this seems like a reasonable thing to do. However, this was in reality a pretty weak guarantee. The first time you call `unparse()`, `_query_dict` was being updated with the contents of `_url_updates`. Additionally, it is very easy to accidentally modify the `_query_dict` object (`unparse()` was probably doing it on accident). A much better way to have a record of the original query string would be to keep a separate copy of it in a privatish attribute - as with `_orig_url` and `_orig_netloc`. The good news is that I didn't find any place where we do in fact need that, so I just left it out. But it would be easy to add in the future if necessary. Anyways, now there is just **one** dictionary of query parameters - one place to look when trying to determine the current state of the parsed url without turning it back into a string.
We mistakenly misread the name-enforcement regex `subreddit_rx` to say that subreddit names can be a maximum of 20 characters, and so set the maximum length of the field for custom subreddit themes at 20. The maximum length is actually 21, which means that a people have been prevented from using themes from certain subreddits.
This adds .subreddits-page to /subreddits/mine and /subreddits/search
The individual subreddit style pref overrides the global (show custom styles) pref. If the subreddit style is disabled, the default reddit style will be displayed for that subreddit (which can be the default style they select or just none).