Commit Graph

5892 Commits

Author SHA1 Message Date
MelissaCole
6fd9cb472e Modify emailer to allow sending emails with attachments 2015-05-01 11:08:55 -07:00
umbrae
1cc384033b Remove now-defunct explore feedback link 2015-05-01 09:47:48 -07:00
umbrae
852243b802 Add support for 'ref' tags and add to trending subreddits.
A "ref tag" is a query parameter we may pass to ourselves to let
us know where a user came from, and more specifically, what part
of the page they clicked on to get there. This allows us to know,
for example, if users are clicking through from trending
subreddits or if they're just clicking on the subreddit from a
link. This helps us know if features are used/valuable or not.

A ref tag will be passed through and then removed from the URL via
javascript post-load to make a clean URL that's nice for
copy/pasting elsewhere, and doesn't give false positives if they
do paste it somewhere else.
2015-05-01 09:47:48 -07:00
xiongchiamiov
6ef290a1cf Userpage: fix top listings for comments
If you go to a userpage and sort by top (in either the overview or comments
tabs), and restrict the time range to anything other than "all time", no
comments will be shown.

The data in these listings is built from functions in `lib/db/queries.py`
(specifically from `get_comments()` down).  This ends up trying to pull the
query results from permacache (in `CachedResults.fetch_multi()`), defaulting to
an empty list if no cache entry is found.

Now, the cache entry is supposed to be populated periodically by a cronjob that
calls `scripts/compute_time_listings`.  This script (and its Python helpers in
`lib/mr_top.py` and `lib/mr_tools/`) generates a dump of data from Postgresql,
then reads through that and builds up entries to insert into the cache.  As
with many scripts of this sort, it expects to get in some bad data, and so
performs some basic sanity checks.

The problem is that the sanity checks have been throwing out all comments.
With no new comments, there's nothing new to put into the cache!

The root of this was a refactoring in reddit/reddit@3511b08 that combined
several different scripts that were doing similar things.  Unfortunately, we
ended up requiring the `url` field on comments, which doesn't exist because,
well, comments aren't links.

Now we have two sets of fields that we expect to get, one for comments and one
for links, and all is good.

We also now have a one-line summary of processed/skipped entries printed out,
which will help to make a problem like this more obvious in the future.
2015-04-30 15:53:33 -07:00
umbrae
15bd2fa988 Newsletter: Increase timeout on add subscriber 2015-04-29 12:52:53 -07:00
umbrae
fe35d86eeb Newsletter: Add stats tracking to add subscriber 2015-04-29 12:52:53 -07:00
umbrae
889848478f Newsletter: minor margin/padding tweaks to standalone 2015-04-29 12:52:52 -07:00
umbrae
60f1ce15e5 Newsletter: update verbiage to suggest confirming email 2015-04-29 12:52:52 -07:00
umbrae
4c50a221e5 Newsletter: fix close box on newsletterbar 2015-04-29 12:52:51 -07:00
umbrae
06e321674b Newsletter: add FAQ to standalone page 2015-04-29 12:52:51 -07:00
umbrae
3ed813d305 Newsletter: force HTTPS for requests 2015-04-29 12:52:50 -07:00
umbrae
4c83ff840b Newsletter: minor layout and design tweaks 2015-04-29 12:52:50 -07:00
umbrae
db1388bde5 Newsletter: handle unacceptable emails
If an email address is already unconfirmed, unsubscribed, or on
a block list, it will return a 400 level response. Unconfirmed
will be most likely by far. Here we handle those cases.
2015-04-29 12:52:49 -07:00
umbrae
58c04b70e4 Newsletter: pass source into API resource 2015-04-29 12:52:48 -07:00
umbrae
50add4209e Newsletter: Add standalone subscribe page at /newsletter 2015-04-29 12:52:47 -07:00
umbrae
031e20ed36 Add feature-flagged newsletter bar to the logged-out homepage. 2015-04-29 12:52:47 -07:00
umbrae
3d8f234b68 Newsletter: fix request exceptions typo 2015-04-29 12:52:46 -07:00
umbrae
04c2ac2d90 Newsletter: Capture emails from interested users on registration
Adds an an opt-in checkbox to the registration flow for the
upvoted newsletter, a project Alexis and Heath are working on.

This does not associate any data with the user's account, it
just sends their email address to the campaign monitor API if
they opted in.
2015-04-29 12:52:46 -07:00
Jordan Milne
76555a9d4a Add a more sensible list of chars to escape in scriptsafe_dumps 2015-04-29 12:51:42 -07:00
Jordan Milne
5fd2969f44 Rename jssafe_dumps to scriptsafe_dumps
The new name better reflects that the function isn't safe to use
in inline event handlers, only `<script>` blocks.
2015-04-29 12:51:39 -07:00
umbrae
13c7122d6b Make user karma not look like a link 2015-04-29 12:34:53 -07:00
umbrae
51f1e0042d oEmbed: Add endpoint, with support for comment embeds 2015-04-29 12:34:42 -07:00
umbrae
00324fb1ca Comment embeds: move inject template definition to python
Previously the HTML fragment for a comment embed was defined
only in JS. This isn't ideal when we want to be able to return
that fragment in other contexts (like the forthcoming oEmbed).
2015-04-29 12:33:30 -07:00
umbrae
36877cff31 Suggested sorts: Add to API docs 2015-04-29 12:33:24 -07:00
umbrae
cc648c7719 Suggested sort: Add preference to ignore suggested sorts 2015-04-29 12:33:07 -07:00
umbrae
1676e79b98 Utils: add url_to_thing 2015-04-29 12:33:01 -07:00
xiongchiamiov
5d9ce3675d Footer: switch mobile sites
We've launched the new new mobile web experience - yay!  Since we switched over
the mobile hint for Google in reddit/reddit@63f054d, I figured it was probably
time to do so in the footer as well.

Oh, and it redirects all http traffic to https, so we should just point to that
directly.
2015-04-29 11:40:25 -07:00
Brian Simpson
13c3121b10 PromotedLinkJsonTemplate: include "href_url" attribute. 2015-04-28 06:05:16 -04:00
Kevin O'Connor
0ace5007d4 mobile_link should be HTTPS only
Crawlers will first go to http://www.reddit.com, see the alternate
link for a mobile page at http://m.reddit.com, go there and then
be redirected to https://m.reddit.com since m.reddit.com is HTTPS
only via a CDN page rule. This sidesteps that extra request.
2015-04-28 16:07:15 -07:00
Florence Yeun
929e168280 Search: fix bad merge resolution
Fix name error introduced in reddit/reddit@5f8f863.  `elapsed_time`
should have been removed.
2015-04-28 13:51:48 -07:00
Chris Stephens
98ddd8cd06 listing: Allow additional subreddit details to be embedded in link objects
Passing the sr_detail flag will embed an abridged subreddit object
2015-04-28 13:44:16 -07:00
zeantsoi
7486474d5e Add second 3rd-party tracking pixel 2015-04-28 13:05:40 -07:00
zeantsoi
8e0fbb739e Default target platform to 'desktop' 2015-04-28 12:09:08 -07:00
Brian Simpson
bbffb0a87c CommentPane: just get the comments when checking if we can use cache.
The cached version of a CommentPane is valid only if the user is not the
author of any of the comments. Previously we would retrieve and build
the comment tree for the user to check if we could use the cache, and then
on a cache miss we'd re-retrieve and re-build the tree for a logged out user
to create a version suitable for caching.

This commit changes it so the CommentBuilder can retrieve the comments that
will be shown so we can check if the user authored any of them. Then if we
can use the cache and there's a cache miss we can build the rendered tree
for the logged out user without re-retrieving, and the building happens only
at this stage.
2015-04-28 01:01:10 -04:00
Brian Simpson
b17c4031e1 CommentPane: clean up and add more timing events. 2015-04-28 00:42:15 -04:00
Brian Simpson
1ad4609393 CommentPane: fix try_cache logic.
When making changes I flipped the check for `sr.can_ban`. Don't
try to use the pagecache if the user can ban.
2015-04-28 00:41:13 -04:00
Brian Simpson
ab8be53cdc CommentPane: clean up try_cache logic. 2015-04-28 00:37:25 -04:00
Brian Simpson
be7eb84460 CommentPane: Use separate timer for non-html requests. 2015-04-28 00:36:54 -04:00
Florence Yeun
ff9cdc4c97 Search: Fix restrict_sr checkbox to reflect current search
On the search page, the "limit my search to [subreddit]" checkbox
should always reflect the current search and not the stored preference.

In the sidebar, the checkbox will continue to be checked or not
checked according to the stored preference.
2015-04-28 10:24:22 -07:00
Florence Yeun
1b4415c9e2 Search: Don't show error message if no search query
Don't show the "there doesn't seem to be anything here" error message
if no search query was provided.
2015-04-28 10:24:09 -07:00
Chad Birch
e4a7294431 AutoMod: fix bug with approving reported items
An approve action should only trigger on a reported item if the rule was
specifically looking for it being reported. Previously, any rule with an
approve action could end up triggering on an item when it was re-checked
due to a report.
2015-04-25 23:33:41 +09:00
MelissaCole
55c22f96ca Display gold expiration for users
If users have the 'show gold expiration' preference checked, then how much
gold they have remaining will be shown on their userpage to the public.
2015-04-24 11:08:43 -07:00
MelissaCole
fc48bb602c reddit_themes: pref_other_theme doesn't always exist
This fixes a KeyError that occurs when pref_other_theme isn't passed in.
2015-04-24 11:08:37 -07:00
Florence Yeun
e00ecab492 Search: Add link to enable NSFW results
When the safe search feature is enabled, NSFW links and subreddits
will not appear in search results unless the over18 preference has
been set by the user.

For easy access to the over18 preference, add a link to enable NSFW
search results on the main search page and the subreddit search page.
Clicking on the link will redirect to the /over18 confirmation page.
The link will not appear if the over18 preference was already enabled.
2015-04-24 10:53:56 -07:00
Jordan Milne
dce698f1ea Don't treat strings in ObjectTemplates as StringTemplates
This was leading to strange behaviour like `<$>timesince</$>` in a
random string field rending as `just now`. It might have been necessary
when we were caching `JsonTemplate`s, but we don't anymore.
2015-04-23 17:31:02 -07:00
Jordan Milne
fba85b651a Import wrapped stuff in conditional_websafe, not at the top level
Having the import here means we can't import anything from `filters`
with a clean build environment. `wrapped` won't exist yet, and we need
`scriptsafe_dumps` for the JS build!
2015-04-23 17:30:38 -07:00
Jordan Milne
a770f9fcce Add /user/me/* catchall before plugin-defined routes
This fixes an issue with `/user/me/snoo` since `/user/:name/snoo` is
defined in `-gold`.
2015-04-23 17:30:29 -07:00
Jordan Milne
9781696e0d Throw out broken Cookie headers in BaseController.__before__
This fixes an issue where we were parsing `request.cookies` before
checking if the cookie header was even valid:
86a3d262f2/r2/r2/controllers/reddit_base.py (L1477)

This lead to a lot of hard-to-track down issues like us ending up
in `<Controller.post>` with inconsistent state due to `pre` aborting.

Before we were throwing them out in `RedditController.pre`, but we
need `request.cookies` in `MinimalController.pre` as well:
86a3d262f2/r2/r2/controllers/reddit_base.py (L1099)

Since `RedditController.pre` uses `request.cookies` before calling
`MinimalController.pre`, I took the easy route and put the header
cleaning code in `BaseController.__before__`, before either `pre`
gets run.
2015-04-23 17:30:19 -07:00
Jordan Milne
f054320587 Work around Chrome crashing on links with overly long hostnames
See https://code.google.com/p/chromium/issues/detail?id=464270
2015-04-23 17:30:11 -07:00
MelissaCole
a30cc40f77 Consolidate gold ad preferences into one
This moves the 3 ad preferences (300x100, 300x250, and sponsors) into
1 preference (hide ads) for simplicity.
2015-04-23 11:39:21 -07:00