Commit Graph

7852 Commits

Author SHA1 Message Date
Matt Lee
fcee900fe7 Expando: Feature flag nsfw flow 2016-10-07 17:42:43 -04:00
Matt Lee
f9a4bebb2f Expando: New NSFW media flow
Conflicts:
	r2/r2/lib/template_helpers.py
	r2/r2/templates/link.html
2016-10-07 17:42:42 -04:00
Matt Lee
749ee7c22e Expando: Update icons under feature flag 2016-10-07 17:42:42 -04:00
Matt Lee
bfd5a327c1 Media Previews: Show for direct image links 2016-10-07 17:42:42 -04:00
Matt Lee
900ba93e9a Feature flag media previews 2016-10-07 17:42:42 -04:00
Matt Lee
ebac4439f1 Show media preview images 2016-10-07 17:42:42 -04:00
Matt Lee
e0c16b8714 Feature flag auto-expanding media previews
Conflicts:
	r2/r2/models/link.py
2016-10-07 17:42:42 -04:00
Matt Lee
2fba350079 Add preferences for auto-expanding media previews
Conflicts:
	r2/r2/models/link.py
2016-10-07 17:42:42 -04:00
Neil Williams
64813ada66 Update baseplate integrations
This syncs with the changes in baseplate to diagnostics for OpenTracing
consistency.
2016-10-06 16:49:24 -07:00
Brian Simpson
21ee09a107 RavenErrorReporter: set user and oauth data in user_context 2016-10-06 13:40:47 -07:00
Chad Birch
414f9535b0 Remove multiple-sticky transitional code
Subreddit sticky posts (announcements) were originally implemented with
only allowing a single sticky to be set. When we added support for a
second sticky, there was some transitional code added that would handle
automatically converting the old single sticky to the new storage format
for multiple.

Everything's been long converted now, so this is no longer necessary to
keep around.
2016-10-06 13:10:36 -06:00
Brian Simpson
fd17945edf Delete log_q 2016-10-04 13:45:11 -07:00
Brian Simpson
5d75e3e5b9 Delete log_text()
This fed non-Exception events into /admin/errors. None of these have been
actively monitored for years. If we do care about monitoring stuff like
this we should use graphite or Sentry.
2016-10-04 13:44:37 -07:00
Brian Simpson
d82a63a88a Delete AdminErrorLog.
It has been replaced by Sentry.
2016-10-04 13:35:46 -07:00
Brian Simpson
5afcdd5f0a RavenErrorReporter: Add "app" query param to tags context 2016-10-04 13:35:40 -07:00
Brian Simpson
2c4af10784 RavenErrorReporter: Add HTTP and reddit context 2016-10-04 13:35:30 -07:00
Brian Simpson
d2c91349f6 RavenErrorReporter: Set culprit to controller.action 2016-10-04 13:35:06 -07:00
Brian Simpson
396ef71a9b RavenErrorReporter: move repository hashes to "modules" 2016-10-04 13:35:00 -07:00
Brian Simpson
681d82749f install_apt.sh: Add python-raven 2016-10-04 13:34:46 -07:00
Brian Simpson
24d71d7a87 Add RavenErrorReporter to report exceptions to Sentry 2016-10-04 13:34:41 -07:00
Brian Simpson
1b19ccc5a0 WikiPage.create: Be careful when creating to avoid duplicates 2016-10-04 13:33:32 -07:00
Chad Birch
ae17de114c OAuth2Client: fix definition for .deleted
The deleted property previously wasn't defined as a bool, so setting it
to True or False ended up with the strings "True" or "False" being saved
to the backing CF. This meant that trying to explicitly set a client as
not deleted would only work if you set the value as an empty string (or
completely removed the property), since attempting to set it as False
would save a string that still evaluates as True in a boolean context.

As part of this change, I also ran a backfill script that went through
and converted all existing .deleted values in the database. Anything
with a value of "True" was converted to "1" (since that's the only value
that something defined in _bool_props will accept as True), and it just
removed the property from anything with empty strings as values.

In addition, this adds .deleted to OAuth2Client._defaults so that it's
not necessary to use getattr() all the time to access it.
2016-10-03 16:24:42 -06:00
Chad Birch
dde200de98 POST_wiki_revision_revert: fix special page check
Reverting a special page that isn't stored as an attr on the Subreddit
(the automod config or the stylesheet) currently causes a crash here
(but with no other adverse side effects).
2016-10-03 16:24:37 -06:00
Chad Birch
1d9b5c8500 VCanDistinguish: 404 if invalid thing_name
Currently if the VByName call returns None, this validator will just
crash.
2016-10-03 16:24:27 -06:00
Chad Birch
23e0b21cd2 POST_unfriend: abort if no specified user 2016-10-03 16:24:11 -06:00
Chad Birch
92b6e2fee2 AutoMod: fix bug with int account threshold checks
It should be valid to define a check for one of the account thresholds
similar to:

    author:
        comment_karma: 0

to check for exactly that value. However, since this is parsed in as an
int, trying to do a regex match on it (to check for the presence of an
operator - equal/greater-than/less-than sign) crashes.

This ensures that the comparison value is converted to a string so that
the rest of the code can handle it.
2016-10-03 16:24:05 -06:00
Chad Birch
8f58a8fe00 Send actual ip when preventing private IP storage
This will make it easier to investigate the cause of the issue when we
have an alert from the graphite event rate going off.
2016-10-03 16:23:59 -06:00
William Ting
8ada8a3562 Revert "Search: Test new relevance2 relevancy"
This reverts commit 862ad8abfca5228c2abbc6309c0ceccac7745a43.
2016-09-28 13:46:46 -07:00
William Ting
0d4be6c244 Revert "Search: Fix sort menu for relevance2 test"
This reverts commit cd03ff38a84e4fc7a393c40af78f3c688a656b90.
2016-09-28 13:46:46 -07:00
Chad Birch
6106c6aa50 utils.timetext: use long to handle larger periods
timetext() deals with seconds, and it is currently giving weird results
for any time period that's longer than the max int value of 2147483647
seconds (about 68 years). The total number of seconds was already being
declared as a long, but one of the intermediate variables used in the
calculations was still an int and caused this issue.

This switches that variable to long as well, which resolves the problem.
The unused variable `count2` was also removed.
2016-09-28 12:10:22 -06:00
Brian Simpson
dbcf37afe2 wrapped: Use correct cache key when in the parent template 2016-09-26 13:30:43 -07:00
Ricky Ramirez
acdd4ffc62 wrapped.pyx: Use hash for cache_key(). 2016-09-26 13:30:39 -07:00
Peter Wildani
56666ee64b Add custom delimiters to ConfigValue.
This better supports nested complex values without going all the way to json syntax.
2016-09-26 09:29:27 -07:00
Chad Birch
284c6c5a12 UserRelManager.add(): catch CreationError
The add() function uses a get() at the beginning to avoid creating
duplicate relations, but concurrent requests can get past this point and
will throw a CreationError when the rel is committed. This handles that
case as well and returns None, the same as if the initial get()
determines that the rel already exists.
2016-09-22 13:29:06 -06:00
Chad Birch
3c7322a5b0 VWikiPage: catch ValueError from bad hex string
Currently, passing an invalid hex string as a wiki revision ID will
cause a 500, due to an unhandled ValueError. This catches it so that a
404 will be returned instead, similar to incorrect (but valid hex)
revision IDs.
2016-09-22 13:29:01 -06:00
Chad Birch
a57450aec3 Subreddit settings API: add allow_images 2016-09-22 13:28:55 -06:00
Chad Birch
3f48f18987 Don't store private IP addresses
Storing a private IP address for a user indicates that they're using an
internal "app" (mweb, modmail, etc.) that isn't passing along the user's
actual IP correctly.

Storing these IPs is not useful at all, so this commit checks if an IP
is private before storing it. However, getting to that point signals an
issue that needs to be resolved, so this will send a graphite event that
we can alert on to know that we have an app that needs to be adjusted.
2016-09-22 13:28:51 -06:00
Chad Birch
335b7fd9b5 LinksByUrlAndSubreddit: truncate very long urls
There are a few urls in the system that are extremely long (100,000+
chars). Cassandra's maximum key length is 64kb, so the whole url can't
be used as a key for these. This truncates the url at 65,000 characters
to prevent that from happening.

We should probably also implement a maximum url length, but this
prevents crashes from the pre-existing urls longer than that.
2016-09-22 13:28:36 -06:00
Chad Birch
7d6af3d397 utils.domain(): re.search() instead of findall()
Using findall is very slow on large urls, and completely unnecessary
since we only want the first match anyway.
2016-09-22 13:28:31 -06:00
Chad Birch
2683ce815c Fix empty locale errors in format_number/percent
The previous attempt at this fix (296f378b) still did not resolve the
issue.

This commit falls back to g.locale if c.locale is not set, instead of
trying to fall back to the LC_NUMERIC env variable.
2016-09-22 13:28:24 -06:00
Chad Birch
47fab5532d Revert "Fix empty locale errors in format_number/percent"
This reverts commit 296f378bc68f4732c17a23d0e188ef03b4e97501.
2016-09-22 13:28:19 -06:00
Chad Birch
cc571434b7 Send amqp messages for delete/remove/approve 2016-09-22 13:27:30 -06:00
Chad Birch
16d0b8dc66 POST_flaircsv: handle blank flair_csv param
This endpoint is currently crashing if nothing is supplied for the
flair_csv param. Returning immediately seems reasonable - no flair
updates requested, so there's nothing to do.
2016-09-22 13:25:19 -06:00
William Ting
1e49469d8f Remove redundant /jobs routing.
This line duplicates / shadows a previous /jobs redirect. You can tell it's not
being used by visiting /jobs on prod.
2016-09-22 11:36:57 -07:00
zeantsoi
05e947de43 Vagrantfile: remove adzerk plugin (#1694) 2016-09-21 17:56:29 -07:00
Brian Simpson
0d772e3035 Templated: Collect timings on rendering 2016-09-21 14:24:59 -07:00
Brian Simpson
a8ba98cc48 Templated: Remove unpublished timer in _render()
This was only used in the timing display bar thing, but wasn't very useful.
2016-09-21 14:24:59 -07:00
Brian Simpson
5c43a83547 Templated: Remove timer for g.timed_templates
These timings were never published and sort of are duplicates of the
"render.RENDER_CLASS_NAME.cached" timer in Templated._render.
2016-09-21 14:24:59 -07:00
Brian Simpson
7eb3ab2080 MinimalController: Stop logging useragent string on every request 2016-09-21 14:24:54 -07:00
Brian Simpson
8f6478992c FastlyCdnProvider: Implement get_client_ip and get_client_location
For now these depend on something setting the old CloudFlare headers
"CF-Connecting-IP" and "CF-IPCountry".
2016-09-20 15:48:39 -07:00