Commit Graph

5470 Commits

Author SHA1 Message Date
David Wick
d667ffef24 Comment embeds: reduce reflow 2015-02-23 18:09:55 -08:00
xiongchiamiov
e29e727791 Comment embeds: add per-comment token
While in the process of rolling out comment embeds, we'd like to have restrict
our beta a bit - because by their nature, once embeds are out, we lose control
over them, making it extremely difficult to make changes.  So we're restricting
the embed generation modal to a certain subset of users (for now), but a savvy
user could simply modify an existing public embed to plug in another comment
id, which would defeat the point of restricting it.  Enter hmac.

We know generate a unique token for each comment, and only by using the
appropriate token will your embed work.  This will be transparent to users, as
its just another piece of the html that they copy and paste onto their website.

Performance-wise, we're generating tokens for every comment that can be
embedded.  However, for now that's a limited set, and the operation is pretty
fast (roughly 5ms for 1000 tokens on my dev VM); if that becomes a problem, we
can easily take this code out after we no longer need the restriction.
2015-02-23 18:09:55 -08:00
xiongchiamiov
e454857b31 add_sr: allow alternate domains for https pages
`add_sr()` has had, since reddit/reddit@b57dff70, a special-case when the
requested page was on https, where it would ignore whatever domain it would
normally set and use the current one instead.  As best as we can tell, this was
to prevent issues with a lack of https support on all reddit domains, eg links
on `https://pay.reddit.com` pointing to `https://www.reddit.com`.  This should
no longer be an issue.

Additionally, it has caused problems with the comment embeds, which are served
from `redditmedia.com` but need to have links pointing to `www.reddit.com`.

Now that this special-case doesn't exist, the function should act more
intuitively.  And hopefully that doesn't break anything too badly. :p

The request from the comment embed javascript to get the actual embed has been
going through `g.media_domain`.  This in turn meant that sometimes (namely,
when the embed was placed on an https page) the link to the comment was also
heading through the media domain.  While this works, we'd rather have users go
through the standard `www.reddit.com` domain for brand, caching, and probably
other infrastructure reasons.
2015-02-23 18:09:55 -08:00
xiongchiamiov
bf300d1ecc Comment embeds: fix subreddit link
At the bottom of the comment embeds is a link to the subreddit from which the
comment was extracted.  This link has had an extra domain appended, so we'd end
up with URLs like `http://www.redditmedia.com/www.reddit.com/r/worldnews`.

The problem stemmed from the fact that `get_domain()` returns a protocol-less
URL (`www.reddit.com/r/worldnews`).  Thus, `add_sr()` (which it ends up being
passed into) assumes it has been handed a relative URL and appends a domain.

Instead of getting the entire domain, we now just get the subreddit path and
let `add_sr()` handle the domain (and protocol) later.
2015-02-23 18:09:55 -08:00
David Wick
a5728036a2 Comment embeds: prevent embeds from being converted multiple times
With multiple embed snippets comes the inclusion of the embed
script multiple times (and therefore multiple execusions of it).
This fixes the race condition that occurs when `init` is run
multiple times before the `<div>` is removed and as a result
multiple iframes for the same embed are included in the page.
2015-02-23 18:09:55 -08:00
David Wick
c54d035c5e Fix embed footer being cutoff
Tables treat `height` as `min-height` and disregard `min-height`
in firefox.
2015-02-23 18:09:55 -08:00
David Wick
99e3b00039 post-message.js: Allow events to be scoped to a source.
Embeds were listening to `postMessage`s from other embeds and
causing weird behaviors.
2015-02-23 18:09:55 -08:00
David Wick
08f61238a6 Fix 1x snoo crop 2015-02-23 18:09:55 -08:00
David Wick
fe0fb1723c Comment embeds: fix missing "load more comments" regression. 2015-02-23 18:09:55 -08:00
David Wick
099c1ecba1 Do not mangle names of embed scripts 2015-02-23 18:09:55 -08:00
David Wick
59cddc30bc Comment embeds: only show button on permalink page 2015-02-23 18:09:55 -08:00
David Wick
8ef0d66922 Comment embeds: add feature flag 2015-02-23 18:09:54 -08:00
David Wick
9584157319 Remove new login flow feature flag 2015-02-23 18:09:54 -08:00
David Wick
77ff39a511 Remove dead compact login code 2015-02-23 18:09:54 -08:00
David Wick
cc585b9345 Refactor modals to use a common component 2015-02-23 18:09:54 -08:00
David Wick
e5d579e020 Comment embeds: add UI for creating embed code 2015-02-23 18:09:54 -08:00
David Wick
6493c95ea2 Remove unused css 2015-02-23 18:09:54 -08:00
David Wick
3349dda147 Comment embeds: add support for data attributes in menus 2015-02-23 17:38:52 -08:00
David Wick
7acbd4d6b0 Comment embeds: support including scripts using absolute paths
This is useful for generating the script tags needed by the embed
snippet in such a way that it works for both dev and production
environments.
2015-02-23 17:38:43 -08:00
David Wick
cb70bc65d9 Comment embeds: add bootstrap modal 2015-02-23 17:38:37 -08:00
David Wick
47edd7e3d2 Comment embeds: add new framable template 2015-02-23 17:37:58 -08:00
David Wick
01e124c52b underscore.js: Remove "/" as an escape character 2015-02-23 17:36:20 -08:00
David Wick
88e7eaab9d Ensure namespace is defined
Previously this timings snippet assumed that window.r was an
defined and an object.  This ensures we don't throw errors as a
result for admin bar timings.
2015-02-23 17:36:13 -08:00
David Wick
caeab56e17 Gold: remove unused/broken tracking
This was causing issues with people who have adblock/ghostery and
is no longer being used so I removed it.
2015-02-23 11:46:12 -08:00
Chad Birch
64c7f0bfdf Captcha JS: use siblings()
Previously this was looking for a parent <form> and then searching for
the hidden iden input inside that form. siblings() is much more
efficient and removes the dependency on a parent form existing (which it
doesn't, on the create subreddit page)
2015-02-20 10:34:59 -07:00
David Wick
89df798970 Ads: Fix AttributeError caused by rename 2015-02-19 18:58:33 -08:00
David Wick
5e13579900 Ads: Show ip/country mismatches to sponsors.
This allows sponsors to review payments that come from outside
the billing credit card address.
2015-02-19 16:17:54 -08:00
David Wick
6d4f9ec2b1 Ads payment: use standard country names 2015-02-19 16:17:04 -08:00
David Wick
f9f34ec539 app_globals.py: Add locations 2015-02-19 16:16:53 -08:00
Robert Ditthardt
decac6c13c Multis: Do not redirect api requests 2015-02-19 14:30:13 -08:00
Robert Ditthardt
3d455ed05c Multis: Add limit on fetching multis
This uses Subreddit.random_reddits to limit the number of subreddits
requested to build a multi. The limit is defined in
LabeledMulti.MAX_SR_COUNT
2015-02-19 14:30:13 -08:00
Keith Mitchell
d3fea5e60c Multis: Allow listing requests for multiple multis
URLs of the form /user/<name>/m/<multi>+<multi>+<multi>+...
will be converted to an anonymous multi comprised of the
union of all subreddits in the named multis.
2015-02-19 14:30:13 -08:00
David Wick
22f7e4daea analytics.js: Ensure GA callbacks are called.
If for whatever reason ga fails to call the callback in a
reasonable amount of time (500ms) then fire it off anyway. One
instance where this was biting us was, an addon for firefox
(ghostery) was stubbing out `_gaq.push` with a noop, causing any
functions pushed into it to never be fired.
2015-02-19 14:22:51 -08:00
David Wick
6f6c4acb0f analytics.js: Fix code style 2015-02-19 14:21:37 -08:00
David Wick
7f0f31b78f analytics.js: Use 2 space tabs 2015-02-19 14:21:32 -08:00
David Wick
ca305cb880 Gold: Add funnel events for inline gilding 2015-02-19 14:21:25 -08:00
David Wick
eb6af40d20 Ads: do not track sponsors in funnel 2015-02-19 14:21:15 -08:00
David Wick
3bff0d250e Future promos: Hide links after being rejected
Links that have been rejected should be removed from the page when
the sort is "unseen".
2015-02-19 14:21:07 -08:00
David Wick
6f7fa8aa68 analytics.js: Add optional callback to #fireGAEvent 2015-02-19 14:21:01 -08:00
David Wick
a98e0751e9 Future promos: Hide links after approval
Links that have been approved should be removed from the page when
the sort is "unseen".
2015-02-19 14:20:50 -08:00
David Wick
25c22cb295 Remove reference to /r/promos from user pages 2015-02-19 14:20:08 -08:00
David Wick
c93451d317 Ads: ad creation flow funnel tracking 2015-02-19 14:19:57 -08:00
David Wick
8a38390f26 Add hook for successful ad buys 2015-02-19 14:19:49 -08:00
David Wick
d3dca3ba4a Flagged promotions: display multiple reasons 2015-02-19 14:19:43 -08:00
Trevor Senior
d0beab632e cache: Import random. 2015-02-18 11:37:38 -05:00
Brian Simpson
28e140d05d Message.add_props: Use subreddit attribute set by Builder.wrap_items. 2015-02-18 11:37:32 -05:00
Jordan Milne
6cbbabb9a9 Keep a separate list of subdomains that can't be in c.domain_prefix
I forgot how insanely brittle this bit of code is since I last tried
messing with it last year. At some point we might want to look into
deprecating everything but oauth., the lang subdomains, and www. To
hell with `www.ssl.circlejerk.json.reddit.com`.
2015-02-18 14:50:41 -08:00
Avinash Dwarapu
dc47412df4 Change /{article}/related to /related/{article} in API docs
Frankly surprised this error hasn't been caught...
2015-02-18 14:01:50 -08:00
Brian Simpson
bb07898dcf Use c3.2xlarge instance for EMR hourly traffic log processing. 2015-02-18 03:57:54 -05:00
Chad Birch
bc73cef822 Subreddit creation: add captcha 2015-02-18 13:22:36 -07:00