Commit Graph

6970 Commits

Author SHA1 Message Date
Chad Birch
c0033753e9 Events: add and use add_subreddit_fields function
Similar to add_target_fields, this standardizes the subreddit fields in
one place so that every event doesn't have to know the multiple ones it
should add.
2015-12-17 17:59:53 -07:00
Chad Birch
dbfde9dc6b Vote event: use add_target_fields() 2015-12-17 17:49:27 -07:00
Chad Birch
ce0ab91bc5 Events: set target_type to "self" for self-posts
Vote events were doing this manually, but no other types. This adds that
logic into EventV2.add_target_fields so it will happen everywhere.
2015-12-17 17:49:22 -07:00
David Wick
70c39d2178 Ads: Fix campaigns incorrectly showing up as complete 2015-12-17 13:48:15 -08:00
David Wick
ab4eaf01ca Ads: Remove "forces house priority" from mobile web targeting. 2015-12-17 13:47:13 -08:00
umbrae
7a6fb4ec27 Sticky Comments: do not shuffle stickied comment on random sorts
This reverts commit 60bb850f694133ba65fd51efe2e1b1299c7088ba.
2015-12-17 10:38:51 -08:00
umbrae
0adaad6d53 Uncollapse all comment threads with distinguished descendants.
In sticky comments, we hide comment threads which are children of
a sticky comment to avoid derailing a conversation. However, a
distinguished comment within that chain can override that (as it
should). This means we need to walk up the ancestor list and
de-collapse the thread that leads to this comment.

We were already doing this for Q&A sort which also has special
hiding rules, we just need it to now apply to all sorts.
2015-12-17 10:38:45 -08:00
umbrae
82e991fd8e Sticky Comments: Only color titles for stickied links
Previously this was also including stickied comments, which had a
side effect of coloring titles of links on user pages where the
comment was stickied.

This cleans that up, and additionally cleans up the selectors which
were unnecessarily specified for .visited/:visited - the specificity
of this selector overrides .visited/:visited anyhow.
2015-12-17 10:38:34 -08:00
umbrae
d583cb907b Sticky Comments: Hide child comments of a sticky comment 2015-12-17 10:38:19 -08:00
umbrae
17d914d990 Sticky Comments: Add initial cut of feature
This is a first attempt at allowing mods to sticky a comment per
thread. This builds off of distinguish and lets them set a comment
as sticky. A few rules:

1. Only one comment may be sticky at a time per thread.
2. The comment must be made by a mod.
3. Only top level comments may be stickied.
4. Stickied comments do not accrue karma.
5. Presently, only the author may sticky their own comment.
2015-12-17 10:37:58 -08:00
Neil Williams
e86021995d Make activity_endpoint properly optional 2015-12-17 09:37:08 -08:00
Neil Williams
c88036cdaf Add initial test integration with the new activity service
This service is used to count active visitors within contexts. This
initial implementation allows us to shadow-write and shadow-read
depending on a set of feature flags.
2015-12-16 16:22:07 -08:00
Neil Williams
6e60419984 Add early baseplate integration
This adds simple integration with the new baseplate library so we can
use thrift clients. Further down the line we can hopefully replace
config parsing and metrics with the baseplate equivalents.
2015-12-16 16:22:07 -08:00
MelissaCole
ffe9dc27c0 Include automod and reddit user info in ModAction events 2015-12-16 14:30:44 -08:00
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