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.
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.
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.
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.
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.
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.
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