Commit Graph

5287 Commits

Author SHA1 Message Date
xiongchiamiov
94984b78af Robots: allow crawling of mobile pages
We got a message from Google Webmaster Tools letting us know they'd like to
pretend to be a mobile device and crawl our mobile pages, but can't, because we
disallow it in our `robots.txt` rules.  We have canonicalization set up to
point towards desktop pages, so we shouldn't be hurt by allowing this.

We should also at some point provide two-way annotations to let them go from
desktop -> mobile[0], but for now this should suffice.

[0]: https://developers.google.com/webmasters/mobile-sites/mobile-seo/configurations/separate-urls
2015-01-06 12:03:41 -08:00
Chad Birch
9fc5d0f1eb message.new hook: Call before determining rels 2015-01-06 12:49:07 -07:00
Aedx
bca1c9e7a4 Added missing closing head tag 2015-01-06 11:31:53 -08:00
xiongchiamiov
45ab808c44 Flair selector: minor restyling
This is a tiny little touch-up of the flair selector box that just adds a
little more space between things, because I was annoyed at looking at it.  As
far as my choices for things:

* The `.flairselector h2` change was to make it consistent with the other
  dividing lines in the box.
* The button margin was chosen to be consistent with the "add" button on
  /about/moderators.

I decided not to mess with the wonky vertical alignment on the flair because
that gets changed by subreddits' customizations to flair display, so it's
probably not worth it to try and make it look better.
2015-01-05 14:47:52 -08:00
Neil Williams
f95cb2b143 Rework login ratelimit system.
The goal of a login ratelimit system is to prevent brute force attacks
on passwords.

The current login ratelimit system is based on VDelay which uses
exponential backoff based on IP address after failed login attempts.
This is not ideal because of corporate proxies and LSN causing the
number of false positives to be very high resulting in users getting
the dreaded "you've been doing that too much".

This new system uses a factored out version of the core ratelimiting
system which uses fixed ratelimits per period (allowing some burstiness)
and is per-account. To help mitigate the effects of a denial of service
attack on a specific user, different ratelimit buckets are used
depending on whether or not the user has used the IP the login request
is coming from before.

As an escape hatch, successfully resetting an account's password adds
the current IP to that account's recent IPs allowing it into the safer
ratelimit bucket.

The ratelimit never applies if you are currently logged in as the user,
allowing account deletion to happen regardless of ongoing brute force /
denial of service attacks.
2015-01-05 14:06:46 -08:00
Eric
8fdc799564 Change SubredditSelector to use better wording
Currently, the subreddit selector when submitting a new link "/r/subreddit/submit" says "Popular Choices" and then lists the subreddits you are subscribed to.

I find this to be a big misnomer, as they are not popular choices at all, they are just a list of your subscribed subreddits. "Popular choices" implies that these are things other people have selected as well.

I know, it's super nitpicky, but I thought it might make more sense this way.
2015-01-05 16:11:14 -05:00
Brian Simpson
e0d5d77be9 Remove scrollupdater debug statements. 2015-01-05 16:11:08 -05:00
xiongchiamiov
d53b2a0d6b RSS feeds: fix timestamp
[Reported by][0] /u/josh64.

When the message RSS feeds were created, they erroneously had an extra timezone
appended to the `dc:date` element, which causes validation errors.

In most of the feeds we rely only upon `pubDate`; it's not clear to me why we
additionally use `dc:date` in the few places we do, but I suppose it doesn't
hurt anything.  The other two places using it are `subreddit.xml`, which never
had the extra timezone, and `comment.xml`, in which it was removed three years
ago (reddit/reddit@5675398).  This fixes the last incorrect instance.

Note: Although the reporter says they got an error in the W3C validator and the
format is clearly wrong, in my tests the validator passed the previous,
incorrect feed. *shrug*

[0]: http://redd.it/2r1plf
2015-01-05 11:24:57 -08:00
Jordan Milne
f7d53fbd91 Display points on XHR'd compact pages 2014-12-31 17:43:56 -04:00
Jordan Milne
159c51b2b4 Enforce floor of 0 on link scores across render styles
Thanks to @iKevinY for the report. Fixes #1205
2014-12-31 17:43:53 -04:00
Brian Simpson
4cfbf59af5 Update thing.recipient to thing.user_is_recipient in message.compact. 2014-12-30 19:18:33 -05:00
Brian Simpson
8d90f8be2c Message: don't distinguish author of parent comment. 2014-12-30 19:18:33 -05:00
Brian Simpson
586cc18f71 Messages: always show "from" first. 2014-12-30 19:18:33 -05:00
Brian Simpson
eb0cdbf25c Make messages from user as subreddit more visually distinct.
Previously they looked like a regular message sent from the current
user. Now they indicate they are sent via a subreddit.
2014-12-30 19:18:33 -05:00
Brian Simpson
d2fa4b5364 Message.add_props: detangle logic. 2014-12-30 19:18:33 -05:00
Brian Simpson
7f84f427fc Message.add_props: Use mods_by_srid to find user moderated subreddits. 2014-12-30 19:18:33 -05:00
Brian Simpson
74815d273d Message.add_props: Run set_unread in batch. 2014-12-30 19:18:33 -05:00
Brian Simpson
eef29e4e09 Message.add_props: Batch lookups of override to and author. 2014-12-30 19:18:33 -05:00
Brian Simpson
d30f121f92 Message.add_props: Clean up batch lookups. 2014-12-30 19:18:32 -05:00
Brian Simpson
f55a8dcce5 Message.add_props: Don't use c.user.
Use `user` which is passed into the function.
2014-12-30 19:18:32 -05:00
Brian Simpson
701a292f7c Message: stop setting message_style attribute. 2014-12-30 19:18:32 -05:00
Brian Simpson
188bb28008 Message.add_props: Clean up variables. 2014-12-30 19:18:32 -05:00
Neil Williams
c01ac9eb9c Revert "Ratelimits: add strict enforcement mode."
This reverts commit 6b73de5dd5758d7a6df07ad85668af21afb510f8.
2014-12-30 15:43:03 -08:00
xiongchiamiov
1fb11a187c Profile page: enable comment editing
Giving users the ability to edit their own comments from their user page is
something that RES adds, but we didn't because the data wasn't available or
something.  Someone [brought it up again][0] recently, and it turns out it
*just works* now if we enable it.  And I don't see a good reason to prevent
users from doing it.

[0]: https://www.reddit.com/r/AutoModerator/comments/2olykv/automoderators_flair_and_karma_have_been_wiped/cmoiz4j?context=1
2014-12-29 14:19:03 -08:00
Ricky Ramirez
14a554d10b TransitionalCache: Correct return value for set ops. 2014-12-26 12:21:36 -08:00
Jordan Milne
29777e10f4 Switch to rel="noreferrer" instead of window.open() where possible
I've made a huge mistake
2014-12-22 17:45:49 -04:00
Brian Simpson
15c0a6344f Share: remove recent emails saving. 2014-12-19 21:41:55 -05:00
Brian Simpson
9f3456c485 ShareEmail: Don't link to comments page when promo comments disabled. 2014-12-19 21:41:55 -05:00
Brian Simpson
b6701c1d70 POST_share: explicitly restrict to Links. 2014-12-19 21:41:51 -05:00
Neil Williams
323b4da127 TransitionalCache: return properly from set_fn.
This is causing e.g. `incr`s that check the return value to fail as the
return value is always `None`.
2014-12-22 13:24:46 -08:00
Ricky Ramirez
6e6266563d cache: Add caches property to TransitionalCache.
This attribute is introspected by some hooks.
2014-12-22 13:24:04 -08:00
Ricky Ramirez
7c60b8b910 cache: Add a stats setter for TransitionalCache. 2014-12-22 13:23:54 -08:00
Ricky Ramirez
d93cf13994 Disallow direct use of g.memcache.
Caches should always go through the appropriate cache chain. Making the direct
CMemcache object a local var should prevent abuse in the future.
2014-12-22 13:23:31 -08:00
xiongchiamiov
3f6759d3af Compact: fix register page styling
The styling for the compact register page got messed up with our changes to the
login/register flow.  Eventually perhaps we'll restyle them, but for now leave
them be.

This is building on f752c15, which did the same for login.

[Reported by][0] /u/shamelessguy.

[0]: http://redd.it/2pwite
2014-12-22 11:31:14 -08:00
Jordan Milne
ba6cf12871 Fix ctrl-clicking to open a new tab in Firefox 2014-12-19 17:00:54 -04:00
Jordan Milne
1e660d07f7 Try to deal with non-W3C compliant popup blockers 2014-12-19 17:00:42 -04:00
Jordan Milne
95a2d12aab Work around IE Mobile's window.open nastiness 2014-12-19 17:00:32 -04:00
Matt Lee
6eec6f6681 markdown: Fix broken padding and margins.
Switching to unitless variables for all font-size, line-height, padding and margin
styles requires assigning those variables a unit when using (e.g. @var * 1px).  I
failed to do this in a couple spots, causing the selftext box to lose its padding and
look totally weird.

Also raises the left padding on lists.  Numbers on ordered lists were falling outside
of the comment's container, and getting clipped off.  This also looked totally weird.
2014-12-19 11:10:19 -08:00
Matt Lee
800d755633 Use react.js version with bundled addons.
This does _not_ bump the version number of react, it just uses the version
with addons bundled in.  These are mostly utility features, but the main
reason is for the animations addon.  Trying to add CSS transitions to elements
entering or exiting the DOM _without_ this addon would be a major pain.
2014-12-19 11:10:00 -08:00
Matt Lee
2b0add9a5f markdown: Fix font scaling for sidebar.
Commit 8f1ab15 addressed an issue we were seeing where some subreddit had
huge font sizes with the new markdown styles applied.  The solution was to
structure the styles such that <p> elements had a default font-size of 1em,
which worked well.  Unfortunately, because of the way that the sidebar styles
are structured (and because I kind of forgot about them in that solution),
this caused the opposite problem for some subreddits' sidebars: tiny text.
This applies the same solution to the sidebar text, and does a little bit
of refactoring along the way.

This replaces most references to absolute numbers with variable references.
A scale of font sizes, line heights, and margins used are defined at the top
of the file, and pretty much everything references those (except for small
stuff like borders.). I thought this was slightly easier to reason about than
doing `font-size: @base + 2;` kind of stuff, but it might be a little
overboard.
2014-12-19 11:09:59 -08:00
Matt Lee
0c43190abb markdown: Remove default background color for tables.
Some subreddits use tables for special layout purposes, and the new default
background colors for rows often needs to be overridden.  Since the effect is
pretty subtle anyways, its probably better to just remove it altogether.
2014-12-19 11:09:59 -08:00
Matt Lee
0199b7e77e markdown: Make headers inherit color.
If a subreddit wants to change the default text color (e.g. for a dark theme)
they'd need to override the color for the .md element and each header tag
(h1-h6) individually.  This makes it so the header tags inherit from the .md
element to make this less painful.
2014-12-19 11:09:59 -08:00
Robert Ditthardt
5fc5823230 Relation: Stop dual writing keys. 2014-12-18 17:40:39 -08:00
Robert Ditthardt
17ffe58de6 thing.py: Sanitize fast cache key for Relations.
This makes the fast cache key safe for the memcache ASCII protocol.

NOTE: This will need to be rolled out in a safe manner (usually a downtime) in order to avoid any data integrity issues.
2014-12-18 17:40:23 -08:00
Ricky Ramirez
244ac3bd55 Relation: Cut reads over to the new key name. 2014-12-18 17:40:14 -08:00
Robert Ditthardt
a3c3b45836 Relation: Start dual-writing new key names.
This is the first part of cleansing rel key names of spaces.
2014-12-18 17:38:43 -08:00
Robert Ditthardt
f4b60b59f5 thing.py: Fix name input to be ascii string
_query returns an ascii string for name no matter what. This was causing
an inconsistency in the cache key. u'subscriber' vs 'subscriber'.
2014-12-18 17:38:07 -08:00
Ricky Ramirez
c29c2d6c8d cache.py: Let TransitionalCache modify keys. 2014-12-18 17:37:56 -08:00
Robert Ditthardt
720048c989 thing.py: Create shared _fast_cache_key function
This function is meant to allow all of our Relation code to use the same
key, making it easier to change. It also required a refactor of the
_fast_cache code a bit to operate on cache keys instead of tuples.
2014-12-18 17:37:46 -08:00
Chad Birch
f4dcab845f Thing._byID: raise a useful error for non-int ID
Previously, passing a non-integer ID (usually happens with a string)
to _byID would give the "huge thing_id" error, which was confusing.
2014-12-18 18:10:44 -07:00