For events with a notion of a `target`, this stores:
* `target._age` as `target_age_seconds` in seconds. This is derivable from the event timestamp and the `target_created_ts` but simpler to query if it's denormalized
* For `Link`s, store the `target.title` as `target_title`. The primary goal here is to add more context around reports in Interana.
Also add a test for the report event and fixup the existing tests.
Don't allow sharing, saving, or hiding a deleted post. A user can unsave and
unhide a deleted post so that it's not stuck in the user's saved/hidden lists.
The share feature is currently broken on promoted links that have comments
disabled. Since the share feature relies on links having a comments thread,
hide it for any link with comments disabled.
Neither of these are used at all, so this code can be simplified a bit
by dropping them. get_cols was being specifically set to False in the
code so everything related to it being True was completely dead code.
As of 156672bed6 we started checking the
title of submissions at submit-time to see if they should be set to
NSFW. Between that and backfilling all existing submissions to have the
NSFW flag set correctly based on their titles, we can now remove the
display-time check.
This will allow moderators and submitters to turn off NSFW even if
"NSFW" or "NSFL" is in the title. This was an annoyance in cases where
the submitter puts something like "(not NSFW)" in the title but then had
the flag stuck on because of the display-time check.
So we know whether or not to show a "wiki" button, include wiki_enabled.
This will be "true" if the wiki is public, or if you are a mod/admin and
the wiki is set to "mod only"; othrewise, it will return "false".
We only show the create subreddit button in the sidebar to users whose
account is at least 30 days old, but since there are now some additional
requirements for creating a subreddit, this means that sometimes we end
up showing the button to people that won't be able to successfully
create a subreddit. This keeps the 30-day restriction, but on top of
that also checks that the user's actually going to be able to create
before showing the button.
Otherwise we may pollute the cache with un-loaded Account objects.
This is almost guaranteed to happen when Account.friend_rels needs
to load the Accounts with data immediately after calling
Account.friend_rels_cache.
The string formatting inside of the 'subreddit_report_form' template function is causing
the underscore template tag to get escaped, so the link doesn't render properly on the
frontend. Moving the call to 'unsafe' fixes it, and should be safe since 'sr_name' will only ever be the name of a subreddit or the underscore template tag.
Adds methods to the model and collections to generate JSON compatible
with rendering the rules, and updates (or creates) the rules stored in
sessionStorage on page load and on any change.
The initial rendering of the rules is done in mako, but all subsequent
rendering of the rules is done client-side. Using the wrong template
tags here creates an unnecessary vulnerability that could be used to
XSS attack a limited set of users (mods could potentially XSS attack
other mods of the same sub).
Items in LESS_STYLESHEETS do not automatically rebuild when imported files
change. Items in SPRITED_STYLESHEETS automatically build when any other less
file updates, so that works for now. Stylesheets run through the spriter
will throw an error if they don't actually contain any sprites, so I added a
dummy sprite rule to modtools.less.