Commit Graph

7348 Commits

Author SHA1 Message Date
Chris Slowe
178d7a2ae0 LoId: add loid_created to bucketing_event and ensure proper unquoting everywhere 2016-03-11 10:48:08 -08:00
Chris Slowe
2276f0988e Experiments: add A/B tests for logged out users with a loid.
* add global `g.enable_loggedout_experiments`
 * The new syntax available is `{"experiment": { "loggedout": true, ... }}`
 * Unify the code path to get whether the experiment is enabled with the one to get the experiment variant.
 * add additional test cases to `experiment_test.py` and organize `loid` mocking there.
 * Fixup mocking in `feature_test.py`

*NOTE*: this is a first pass, and still won't work:
 1. on cached pages if we turn the CDN back on
 2. on the *first* page impression by a user before they get a loid (though this case is handled).
2016-03-11 10:47:48 -08:00
Chris Slowe
53e522c51a Experiments: Users excluded from experiments should have feature.is_enabled(user) == False
This patch also breaks off experiment_test.py from feature_test.py for improved readability.
2016-03-11 10:34:26 -08:00
xiongchiamiov
fcbff995b1 Feature flags: add support for experiments
We've long wanted the ability to run A/B tests; they make it much easier to
test out potential behavior, and reduce the self-selection bias you get through
opt-in betas.  This commit adds A/B-type experiment support to the feature
flagging system.

Currently, only server-side checks and tests on logged-out users are directly
supported.  This is purely to scope down the feature enough to make it easier
to get a v1 out.
2016-03-11 10:31:41 -08:00
Chad Birch
5b4ccc9ed6 AutoMod: ensure comment on a post sends orangered
Normally, if a moderator leaves a top-level comment on a post and
distinguishes it, we send an orangered to the author of the post even if
they have "send replies to my inbox" disabled for that post. This is
done since a distinguished top-level comment is often used to give important
information to the author (such as why the post was removed).

However, since AutoMod distinguishes its comments "directly" by just
setting the attribute, this logic wasn't being checked for its comments,
and it hasn't been sending orangereds in cases where it should be. This
commit fixes that, and ensures that it'll always send one whenever it's
commenting on a post.
2016-03-10 17:11:56 -07:00
Chad Birch
86114aa0a6 Distinguish notification: reduce query updates
If a comment gets distinguished and hasn't already been sent to the
parent's author's inbox (due to them having replies disabled), we send a
notification. This is so that users see if a moderator leaves a comment
in reply to one of their posts (often as a reason for removing it).

However, when doing this, we were previously calling queries.new_comment
to send the notification. There are multiple other unnecessary updates
done by this, which can result in strange errors like the comment
showing up twice in the subreddit's comments listing.

This commit changes to just call queries.update_comment_notifications
directly, since that's the only step in new_comment that we actually
needed to be doing.
2016-03-10 17:11:54 -07:00
Chad Birch
b9aa26249f new_comment: rearrange mutator creation
This moves the creation of a CachedQueryMutator inside
update_comment_notifications, to simplify the process of calling it
directly.

Related to that, the CachedQueryMutator inside new_comment is
now only created when it's needed in the (rare) spam-related cases,
since it no longer needs to create one to be able to call
update_comment_notifications.
2016-03-10 17:11:51 -07:00
Chad Birch
3881b3b961 Image preview JSON: account for max ratio
If an image is more than 2x taller than wide, we crop it down to a 2x
ratio when generating the image previews. However, the calculation of
the different preview resolutions wasn't accounting for this maximum,
and was still using the original ratio. Because of this, for tall
images, the reported preview heights were incorrect.
2016-03-10 16:40:48 -07:00
Brian Simpson
b53d138b6f Make it possible to precompute comment order
The comment order will be computed and stored in permacache when
a comment is added or a comment is voted on. Then when the link's
comment listing is viewed it can be read from permacache.
2016-03-10 15:10:14 -08:00
Brian Simpson
21f3785a67 add_comments: Write scores before writing CommentTree
get_comment_scores expects scores to exist for all comments present
in the CommentTree. To ensure this is true, write the scores before
writing the CommentTree.
2016-03-10 15:09:12 -08:00
Brian Simpson
476ac39e45 add_comments: Handle rebuild and combine locks 2016-03-10 15:09:07 -08:00
Brian Simpson
af81459727 Update comment scores in comment_tree.add_comments
This combines score updating with comment tree updating
2016-03-10 15:08:20 -08:00
Kevin O'Connor
29cc2149f4 Only redirect OAuth authorize requests as a result of user action.
Redirecting to the client's `redirect_uri` for any error was an
open redirect. Only redirecting as a result of user action ensures
we're checking errors and only sending a resource owner to a new
page if they've seen the authorize page and have taken some action.

Thanks to /u/avlidienbrunn for reporting!
2016-03-10 13:40:29 -08:00
Kevin O'Connor
a3929831c7 Add additional OAuth error messages. 2016-03-10 13:38:20 -08:00
Chris Slowe
113fb36369 Testing: fix promote_test.py 2016-03-10 10:41:47 -08:00
Matt Lee
955623c6dd Fix broken media test 2016-03-10 10:39:50 -08:00
Chris Slowe
b128f3814c Testing: fix oauth2 new-attr tracking 2016-03-10 10:38:21 -08:00
Chris Slowe
d6f810a3a4 Events: start storing oauth client name and app_type. 2016-03-10 10:29:14 -08:00
Daniel Ellis
3760877b26 mobile: Change gild message on first mobile login. 2016-03-10 10:10:02 -08:00
Neil Williams
158dd2820d Fix URL generation in dev-mode debugger on HTTPS
The interactive debugger was previously generating HTTP URLs even when
on HTTPS. This is because it uses wsgi.url_scheme to determine which
scheme to use when generating URLs and because we're using the paste
server in development, this environment variable was not being set
appropriately. PasteDeploy's PrefixMiddleware will set the variable
correctly based on X-Forwarded-Scheme / X-Forwarded-Proto which we
were already sending from haproxy.
2016-03-09 16:06:33 -08:00
Daniel Ellis
e86333e986 mobile: Gild the first login on an official mobile app. 2016-03-09 15:50:46 -08:00
Chris Slowe
36675c811e Installer: install-reddit.sh needs to pull down install.cfg. 2016-03-08 17:48:05 -08:00
Brian Simpson
cf819333a7 Fix oembed ForbiddenError 2016-03-08 16:00:57 -08:00
Jack Lawson
922c9d7486 Load related_subreddits from thing.site in sub/about/edit json 2016-03-08 14:19:22 -08:00
Kevin O'Connor
b6da38903d Ensure scope exists when checking employee grants. 2016-03-08 13:13:42 -08:00
Brian Simpson
35616f7175 Trophy.by_account: Ignore missing things
Trophy objects can be fully deleted from postgres.
Trophy ids are also cached per user. If a Trophy is deleted without
updating the cached list of ids, it will raise a NotFound when
looked up later, unless we set ignore_missing=True.
2016-03-07 09:36:57 -08:00
Brian Simpson
5fb0d32393 Relation._byID_rel: Add ignore_missing option 2016-03-07 09:36:52 -08:00
Brian Simpson
f58f3c16a7 Vagrantfile: Update box url and checksum 2016-03-04 13:50:57 -08:00
Brian Simpson
e9d39490bb Add zendesk-modmail integration 2016-03-03 15:51:06 -08:00
Brian Simpson
c65a8e1897 Add email provider for sending emails. 2016-03-03 15:51:06 -08:00
Brian Simpson
dc36addb0d WrappedUser: set context_thing_fullname if admin.
We should avoid adding the entire `Thing` as an attribute
because of caching loops.
2016-03-03 15:51:06 -08:00
Brian Simpson
d2c3fb6832 Restrict threaded modmail to html rendering. 2016-03-03 15:51:06 -08:00
Brian Simpson
092758e6ba Send modmail events to event-collector. 2016-03-03 15:51:05 -08:00
Brian Simpson
d3384ce7a5 Message: Add get_muted_user_in_conversation(). 2016-03-03 15:36:45 -08:00
David King
77a5fd9e78 voting.py: log a little more on TypeError 2016-03-03 14:43:06 -08:00
David King
bdab877b2e Fix tuples_to_sstables for Cassandra 1.2
* The constructor for `SSTableSimpleUnsortedWriter` changed
* `sstableloader` changed its directory structure. Now we just don't manage it at all in `tuples_to_sstables` and make the caller do the work
2016-03-03 14:43:06 -08:00
David King
1d35d9e0bf Add support in tdb_cassandra for JSON types
tdb_cassandra requires you to tell it what columns are of what type. We support
a few of them, including `pickle`. This patch adds support for JSON types as
well, which will be much friendlier to multiple tools working with this data
2016-03-03 14:43:06 -08:00
David King
8e37aaf880 Let tdb_cassandra.Model._set_values pass in their own batch mutator 2016-03-03 14:43:06 -08:00
David King
e349f1317f Add snappy dependency for upcoming feature 2016-03-03 14:43:06 -08:00
David King
ef6bb0405b Add top-level <updated> element to Atom feeds
`<updated>` is a required element of `<feed>`
(https://tools.ietf.org/html/rfc4287#section-4.1.1). There's not really a
sensical timestamp for us to put in there because most listings are changed
pretty constantly, so I just put in the timestamp that the feed was last
rendered.
2016-03-03 14:43:06 -08:00
Brian Simpson
32c52ecc75 Only set up comment embed if there is a comment 2016-03-03 12:10:44 -08:00
Brian Simpson
99f27d99c8 Move QA sort to QACommentOrderer
This allows us to remove most of the QA specific sorting logic from the
main CommentBuilder.
2016-03-03 12:10:32 -08:00
Chad Birch
ff0d31eda1 TEMP: redirect /related/ to comments page
We can leave this in for a while until search engines and other clients
figure out that the "related" page is gone.
2016-03-03 11:54:28 -07:00
Chad Birch
7aa4c97430 Remove the "related" page for posts
This page works by just doing a search for the title of the post. The
results are almost always completely useless. It's also hit extremely
heavily by search engine bots and is probably costing us a significant
amount of money doing all of these searches.
2016-03-03 11:54:27 -07:00
Kevin O'Connor
d30cfba527 Display current username prominently on OAuth authorization page. 2016-03-02 15:09:03 -08:00
Daniel Ellis
532de4425c ip_events: Move ip_events to reddit. 2016-03-02 14:31:39 -08:00
Brian Simpson
4c9d5d4484 Make errorlog employee only rather than admin only 2016-03-02 12:13:52 -08:00
Tiffany Dohzen
2546387861 Fix "inbox" tab selection for unread and username mentions 2016-03-02 11:23:55 -08:00
Tiffany Dohzen
b342f4bc6e Remove reddit store from footer 2016-03-02 11:23:55 -08:00
Neil Williams
487699f637 setup: Add comment about why baseplate's in a try block 2016-03-02 10:54:55 -08:00