Commit Graph

6956 Commits

Author SHA1 Message Date
MelissaCole
7902eef667 Allow top-level comments on deleted posts
Discussion can still be valuable and users are allowed to reply to comments
in deleted posts. Notifications will not be sent to the post author.
2015-12-16 14:30:39 -08:00
Florence Yeun
9c680bdd1d Remove cnameframe
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()`.
2015-12-16 13:03:38 -08:00
Florence Yeun
13db867836 Remove c.cname
Remove all occurrences of `c.cname`, which is no longer set by
`set_cnameframe()`.
2015-12-16 13:03:38 -08:00
Florence Yeun
1e1dc1c09d Remove c.authorized_cname
Remove all occurrences of `c.authorized_cname`, which is no longer set
by `set_cnameframe()`.
2015-12-16 13:03:38 -08:00
Florence Yeun
fcc6b08a55 Remove c.frameless_cname
Remove all occurrences of `c.frameless_cname`, which is no longer set
by `set_cnameframe()`.
2015-12-16 13:03:38 -08:00
Florence Yeun
2fc7dcc661 Remove set_cnameframe()
Custom domains are no longer supported. Remove `set_cnameframe()`,
which sets `c.cname`, `c.frameless_cname`, and `c.authorized_cname`.
2015-12-16 13:03:38 -08:00
Brian Simpson
d2c6ac731d Reddit.rightbox: Remove call to "home.add_sidebox" hook.
This was used for thebutton.
2015-12-16 13:03:32 -08:00
Brian Simpson
d3082e46cb CommentTreeStorageV1: Write an empty storage when a link is created 2015-12-16 12:08:57 -08:00
Brian Simpson
563a225d01 CommentTreeStorageV1: Don't trigger a rebuild on miss
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)
2015-12-16 12:08:52 -08:00
Brian Simpson
47aad742c3 get_comment_tree: Don't load if updating the cache. 2015-12-16 12:08:46 -08:00
David Wick
04714c505a Fix missing import
Regression caused by 2c64022c8aca937a875f733d716534322b322e8d.
2015-12-15 15:41:40 -08:00
Chad Birch
8f6dedca05 PerformedRulesByThing: don't store rule YAML
This was originally added for debugging purposes but is no longer
needed.
2015-12-15 16:15:46 -07:00
Chad Birch
48ff9583e3 AutoMod: don't re-generate YAML for rules
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.
2015-12-15 16:15:45 -07:00
Chad Birch
c18dcdcfb3 AutoMod: remove unnecessary double-init for Rule
When a rule doesn't specify whether it applies to submissions or
comments, this was initializing the rules twice as many times as it
needed to.
2015-12-15 16:15:11 -07:00
Chad Birch
b819d39bdf AutoMod: add timers for init process 2015-12-15 16:14:40 -07:00
MelissaCole
77c0c49d47 Fix subreddit names in ModAction json output
The sr_id36 field is working for viewing a json version of the
mod log, but the subreddit name field was null. This adds the
subreddit name back in.
2015-12-15 13:37:09 -08:00
MelissaCole
8feb5764ca Add link to Automod documentation in mod tools
"get started with automoderator" will show up in mod tools if an
automod config wikipage doesn't exist and link to
www.reddit.com/wiki/automoderator.
2015-12-15 13:37:04 -08:00
David Wick
0dbadf4d08 Use stalecache for gold advertisment data 2015-12-15 13:27:04 -08:00
Brian Simpson
d43c528977 all_live_promo_srnames: Use stalecache. 2015-12-15 11:56:54 -08:00
David Wick
6a4a367b80 Fix "gold goal" from throwing errors when no data exists. 2015-12-15 10:21:36 -08:00
Chad Birch
007c8146d0 Prevent deleted/removed posts from being stickied
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.
2015-12-15 10:33:10 -07:00
Florence Yeun
973f4b821e Timeouts: Remove event pixel
The event tracking pixel has been replaced by the event collector.
2015-12-11 12:48:13 -08:00
Florence Yeun
f916b8d873 Timeouts: Use event collector
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.
2015-12-11 12:47:58 -08:00
Florence Yeun
b94cd5c581 Add CryptoJS HMAC-SHA256 library
Source: https://code.google.com/p/crypto-js/
2015-12-11 12:47:51 -08:00
Florence Yeun
e54b4d09b4 Add event-tracker library
Source: https://github.com/reddit/event-tracker
2015-12-11 12:47:42 -08:00
Matt Lee
90f6e96914 Frontend: De-dupe UUID function.
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.
2015-12-11 10:28:19 -05:00
Matt Lee
26434db2d5 Move config migration to separate file 2015-12-11 10:28:06 -05:00
Matt Lee
ccd50c19b4 Frontend: Rename r to res in handleResponse.
It's confusing to use r as a shorthand for 'response' when we also use it
as the main global object for all of our namespaced module code.
2015-12-11 10:27:57 -05:00
Matt Lee
1ef6ce4e51 Frontend: Resolve circular dependencies.
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
2015-12-11 10:27:44 -05:00
Matt Lee
7819200ec7 Simplify hooks.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.
2015-12-11 10:27:30 -05:00
Matt Lee
9b6a56e5ff Frontend: Split init code into two files.
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
2015-12-11 10:27:10 -05:00
Matt Lee
a414af2490 Bugfix: Don't redefine cur_site on window.reddit.
This is getting defined twice now, which is throwing an error and breaking
the logging altogether.
2015-12-11 10:08:09 -05:00
Matt Lee
a47f2c0582 Remove jquery.html-patch.js 2015-12-11 10:07:57 -05:00
Matt Lee
edad542530 Frontend: Detect when config values are accessed through legacy object. 2015-12-11 10:07:57 -05:00
Matt Lee
79fb0fd78f Frontend: Remove references to legacy config global object.
Conflicts:
	r2/r2/templates/reddit.html
2015-12-11 10:07:38 -05:00
Chad Birch
452cf63d1b Subreddit: remove unusable .flair property
The flair_ids() function is disabled, so this property did not work.
2015-12-10 17:20:45 -07:00
Chad Birch
03dec9ef35 Account deletion: clean up a lot more after delay
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.
2015-12-10 17:20:40 -07:00
Chad Birch
c7c7c0e0ed Add hook for subreddit creation 2015-12-10 17:20:35 -07:00
Chad Birch
c801fbd011 Event add_target_fields: add target_created_ts
This will be able to be used to determine the "lag time" of actions like
voting, reports, and mod actions.
2015-12-10 17:20:29 -07:00
Chad Birch
961ebae4f7 Event add_target_fields: minor logic refactoring
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.
2015-12-10 17:20:22 -07:00
Neil Williams
5d9bdeb36f stats: Don't swallow exceptions in timer context manager.
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!
2015-12-10 13:40:56 -08:00
David Wick
21dd73189f Ads: Remove un-targeting keywords for selfserve ad requests only 2015-12-09 16:28:37 -08:00
David Wick
555d65d1fa Use the stalecache for get_nsfw_collections_srnames 2015-12-09 13:48:19 -08:00
David Wick
a87a590acb Google tag manager: Optionally make container id configurable
This allows mobile web/other clients to use this gtm jail with a
different container id.
2015-12-09 13:48:13 -08:00
David Wick
54a4a0c8b9 Ads: Add system keywords for nsfw, sfw, and "popular" 2015-12-09 13:48:03 -08:00
David Wick
edc8ea86f7 srnames_from_site: Allow use of subscriptions as to be configurable
This allows display to reuse this function without changing the
current behavior.
2015-12-09 13:43:42 -08:00
David Wick
88ebd9431e Ads: Hide accept/reject buttons of deleted ads 2015-12-09 13:42:42 -08:00
David Wick
d206bcec74 Ads: Fix fraud review of deleted link 2015-12-09 13:42:41 -08:00
David Wick
f201cefd8a Add DNT usage to the pageview pixel 2015-12-09 13:42:41 -08:00
David Wick
9029c52ef0 promote.py: Add get_served_promos iterator 2015-12-09 13:41:02 -08:00