Remove dependencies on the query parameter `cnameframe`, as it is no
longer used to trigger `c.cname` behavior or for url parsing with
frames.
Remove `UrlParser.cname_get`, `UrlParser.mk_cname()`,
`UrlParser.is_in_frame()`, and `UrlParser.put_in_frame()`.
Instead just assume that the comment tree is empty. One downside
of this approach is that until a comment tree is created (when
a new comment is added), each attempt to retrieve the comment tree
will result in a read hitting Cassandra (permacache).
Doing a rebuild was bad because it caused lock contention if there
were simultaneous attempts to:
1) View the link's comments page
2) Add a new comment
3) Vote on a comment (update_comment_votes retrieves the tree for qa sort)
The yaml.dump() call accounts for almost half the time taken when
initializing a Rule. Since we already have the original YAML that the
user wrote, we can just use that instead of re-generating it ourselves.
When a stickied post gets deleted or removed, it automatically gets
removed as a sticky. However, it's currently still possible to add
deleted/removed posts as stickies, even though they can't possibly show
up for anyone. This commit fixes that.
Use `EventTracker` to send forbidden client-side actions to the event
collector, side-by-side with the event pixel.
Add secrets `events_collector_js_key` and `events_collector_js_secret`
for the client-side shared secret.
The exact same function for generating UUIDs exists in triplicate. This
consolidates them into uuid.js, and replaces the existing uses with the
new one.
Breaks base.js into several modules and moves some init code around
using hooks.
Conflicts:
r2/r2/lib/js.py
r2/r2/public/static/js/analytics.js
r2/r2/public/static/js/base.js
Create hooks on the fly as-needed rather than needing to explicitly
create them up-front. This allows modules depending on a hook to be
loaded before the module that defines it if necessary.
Init calls for modules in reddit-init.js are moved to reddit-init-hook.js
Init calls for modules in reddit.js are moved to reddit-hook.js
Both init modules use the new hooks.js module.
Conflicts:
r2/r2/public/static/js/base.js
When accounts are deleted, we leave almost all of the data related to
them around forever. This results in our builders needing to skip a lot
of items related to long-deleted accounts, and also has various other
unusual effects like causing some subreddits to have shorter (or even
empty) moderator lists in their sidebars because all of the top 10
moderator accounts have been deleted and left in the list.
This commit moves 2 existing pieces of cleanup out of the immediate
tasks that are performed on deletion into the delayed cleanup, removes
the cleanup of oauth app developer permissions (because this code has
never actually worked) and then adds many more new cleanup tasks. The
moved ones are:
1. remove the deleted user from others' friend lists
2. remove the deleted user from others' blocked lists
The new cleanup tasks performed during the delayed cleanup are:
1. Remove the deleted user's email address from their account
2. Unsubscribe the deleted user from all of their subscribed subreddits
3. Remove the deleted user from all moderator positions
4. Cancel any outstanding moderator invites to the deleted user
5. Remove the deleted user from all contributor positions
6. Unban the deleted user from all subreddits they were banned from
7. Unban the deleted user from all subreddit wikis they were banned from
8. Remove the deleted user from all wiki contributor positions
9. Remove all of the user's flair relations in subreddits
A usernote will be added to the deleted account after the cleanup that
lists information about most of these tasks - which subreddits they were
subscribed/demodded/etc. from, so that the information is not lost
completely.
This logic was starting to get a little tangled in here with some
unrelated things being mixed together, so this just splits it out so
that each check is self-contained and only related to the things
actually being added at that time.
The return value of the __exit__ function of a context manager is only
used for its truthiness to determine if any exceptions within the "with"
block should be swallowed.
From PEP-0343:
IMPORTANT: if mgr.__exit__() returns a "true" value, the exception
is "swallowed".
Since the timer was returning "self" which evaluates truthily, any
exceptions inside a timer "with" block would be swallowed. Scary!