Commit Graph

228 Commits

Author SHA1 Message Date
Keegan McAllister 3c40dd3bf3 bugdown: Fix fenced_code for Python-Markdown 2.3
(imported from commit 3954444708e222217407df228f07d2cad402a02b)
2013-04-05 13:14:00 -04:00
Tim Abbott fdefa06190 Eliminate use of old StreamColor model.
(imported from commit c72a06bdc44f30fb6bca299463e259262367e8c2)
2013-04-04 17:48:51 -04:00
Tim Abbott f6affa8802 gather_subscriptions: Use the colors from the Subscription table.
(imported from commit c23829ad4141a97c61e21b970e5031eae20e24b4)
2013-04-04 17:48:51 -04:00
Leo Franchi 8fe82085c4 [schema][manual] Automatically subscribe users to default streams only after tutorial
(imported from commit 6511851c0aee2628bef597bf1310d6f96b0fd1d4)
2013-04-04 17:11:39 -04:00
Tim Abbott 0ee684a4b5 [schema] [manual] Add colors to the subscription model.
This is preparatory for removing the StreamColor model, so we also set
things up so anything changing the StreamColor model changes the
Subscription model too.

The manual task is to run the copy_colors.py management command after
deployment to each of staging and prod.

(imported from commit 1be7523ca59f5266eb2c4dc2009e31209ed49635)
2013-04-04 14:17:01 -04:00
Leo Franchi 0055107cfd Use IANA's TLD list for auto-linkification detecting
(imported from commit 9103fdc92405b92300a793bd1d4f493df64b5b9c)
2013-04-03 09:58:17 -04:00
Leo Franchi a5643efa14 Allow @ in urls
(imported from commit cb2ffe4a8f050e732bb06ab4609997be35577417)
2013-04-02 18:38:38 -04:00
Leo Franchi d127d6f19f Support up to one level deep of nested parens in urls
(imported from commit 3f314b16a47b5267ddb0d18aa6c5456656895f77)
2013-04-02 18:38:38 -04:00
Keegan McAllister 191231ab3d bugdown: Whitelist URL schemes
(imported from commit 76e22cec3918c00faaa903baae74915cc5e64264)
2013-04-02 18:38:38 -04:00
Keegan McAllister 5d538d7a2a bugdown: Allow colons in URLs
(imported from commit b57fc21f4508f2bff3cbc32a6359de686aa3a96e)
2013-04-02 18:38:38 -04:00
Tim Abbott fa20696230 do_add_subscription: Don't unnecessarily fetch subscription from the database.
(imported from commit ffe2c8d2026b60a91dd54f10cfd9df0adbfd7acd)
2013-04-02 14:01:54 -04:00
Tim Abbott 2a46c46fa8 set_stream_color: Pass color to get_or_create.
(imported from commit 0d5f1fd227fd6dc337291d2d07ba24f96080e9e2)
2013-04-02 14:01:54 -04:00
Tim Abbott 1cec86eb2d [manual] Remove now-unused User model.
I think all that one needs to do to deploy this commit is on developer
laptops, run `generate-fixtures --force`.

(imported from commit 34916341435fef0875b5a2c7f53c2f5606cd16cd)
2013-04-02 12:57:10 -04:00
Tim Abbott a8e89962d8 Remove remaining direct usage of the User model.
(imported from commit c494b4e32761e9ce57115da918a86a1d6a0b6971)
2013-04-02 12:07:08 -04:00
Tim Abbott 5dbe8b4c17 [manual] Authenticate using a user_profile as request.user.
When this is deployed to staging, we need to run

./manage.py logout_all_users --realm=humbughq.com

When this is deployed to prod, we need to run

./manage.py logout_all_users

(imported from commit d6c6ea4b1c347f3d9122742db23c7b67767a7349)
2013-04-02 12:07:08 -04:00
Tim Abbott 2fcbb31dcf Access the UserProfile's new is_active field rather than User's.
(imported from commit ed5bdaf3e3d6d20bfb741efdac48d30482ab9ef7)
2013-04-02 12:07:08 -04:00
Tim Abbott 1443edce00 Access the UserProfile's new email field rather than using User.
This is preparatory for stopping using the User model.

(imported from commit a1b0808c8cc2ddd19a25163f91c4f18620c9ce90)
2013-04-02 12:07:08 -04:00
Tim Abbott 3a35c5b00c Add management command to logout all users.
This is intended to be used logging out users during our deployment of
the UserProfile merge, but it could be useful for other things too.

(imported from commit bfe896d854f997f7a4d06e5bc0f19ec5b1aa5e69)
2013-04-02 12:07:05 -04:00
Tim Abbott 303e77c07d Fix clearing of user sessions.
Previously, we weren't clearing the users out of memcached (we just
killed them in the database), so in fact users were not logged out
when we deactivated them for an hour (when the memcached caches would
expire).

(imported from commit 0f0a2f70e003c184106c73b22b876f57c1ef3371)
2013-04-02 11:56:31 -04:00
Zev Benjamin 4a8d8e6fb4 Record statistics for event queues
(imported from commit 88f30a33f0717d5ad1b22a86cf311d7b67c69bf5)
2013-04-01 17:09:22 -04:00
Zev Benjamin a73e2975d7 Add simple function for outputting statistics for use with munin
Eventually we will want to replace this with statsd.

(imported from commit 64246e9f2d13d72f53d009a5e3e456bc6be6296b)
2013-04-01 17:09:21 -04:00
Zev Benjamin 0e0b95ce83 Fix event queue pickle file location
The associated function was moved into zephyr.lib, but the file
location was never updated.

(imported from commit 24c3348533324b0af7c52d6a121eef8b00615275)
2013-04-01 17:09:21 -04:00
Zev Benjamin 6cee57b356 Fix several bugs when register() applies events
(imported from commit 5cd284c59022700de5c5d12182d2056366bf8617)
2013-04-01 15:45:14 -04:00
Tim Abbott b82edb6fd6 [manual] Add User fields to the UserProfile model.
And keep the fields updated, by copying on UserProfile creation and
updating the UserProfile object whenever we're updating the User
object, and add management commands to (1) initially ensure that they
match and (2) check that they still match (aka that the updating code
is working).

The copy_user_to_userprofile migration needs to be run after this is
deployed to prod.

(imported from commit 0a598d2e10b1a7a2f5c67dd5140ea4bb8e1ec0b8)
2013-04-01 14:34:25 -04:00
Tim Abbott bd27343eba Fix incorrect use of user_id as a Recipient type_id.
This should be a user_profile_id.

(imported from commit 3d63a986a4584ba8933c4f8872ed9bb5f3928983)
2013-04-01 14:34:25 -04:00
Zev Benjamin 2c08fcca3a Send an event when a subscription is added or removed
We don't yet send events on property changes, though.

(imported from commit 741e6aff7c6ce8b6a1fa48e4d95317d345c6993d)
2013-04-01 13:07:48 -04:00
Zev Benjamin fe45b1c8ad Send an event when a user joins or leaves the realm
(imported from commit fcedba2d9a3e8968e93faa396113cddd5bf36a9d)
2013-04-01 13:07:48 -04:00
Tim Abbott 9317035fc7 Add hashed_password argument to do_change_password.
This way we're not directly manipulating user.password() in random
management commands.

(imported from commit e6e32ae422015ab55184d5d8111148793a8aca36)
2013-03-29 16:18:38 -04:00
Tim Abbott 198480ef99 Use get_user_profile_by_email more consistently.
The previous situation was bad for two reasons:

(1) It had a lot of copies of the code, some of them missing pieces:
  UserProfile.objects.get(user__email__iexact=foo)

This was in particular going to be inconvenient since we are dropping
the __user part of that.

(2) It didn't take advantage of our memcached caching.

(imported from commit 2325795f288a7cf306cdae191f5d3080aac0651a)
2013-03-29 16:18:38 -04:00
Tim Abbott 2223b60dc0 Switch functions like do_activate_user to accept UserProfiles.
Only a few of them took a User as an argument anyway.

This is preparatory work for merging the User and UserProfile models.

(imported from commit 65b2bd2453597531bcf135ccf24d2a4615cd0d2a)
2013-03-29 16:18:37 -04:00
Tim Abbott 9d82bb5318 event_queue: Add requests 1.x compatibility.
The previous version of our code only worked with python-requests <
1.0 (as is the case on our servers), the new version will work with
any python-requests new enough to have a .json at all.

(imported from commit 77ffe3e0d890fe88776c313e0e3289aee1bb30ea)
2013-03-29 16:18:37 -04:00
Zev Benjamin 36ac717872 Lower the server-side heartbeat frequency slightly so its maximum value is less than 60
(imported from commit d61e12a985d833843c9ae757465701f0057d5ee8)
2013-03-29 11:11:34 -04:00
Zev Benjamin 3b5bcdf80e Move the guts of event_register_backend to actions.py so it can be called internally
(imported from commit 4747942b03406e8a92f319658fcecb9720226388)
2013-03-28 16:57:48 -04:00
Zev Benjamin 0caec89fc6 Use helper functions instead of importing event_queue.client and event_queue.user_clients directly
(imported from commit 653decf415e0026439dd5d323bed361732dac2e9)
2013-03-28 16:57:48 -04:00
Zev Benjamin cec9c6f30d Send heartbeat events to all clients
This effectively implements a server-side timeout for get_events

(imported from commit 4151562358329a6a5662f219ab2a9241e54ad585)
2013-03-28 16:57:48 -04:00
Zev Benjamin c6df5af84d Import tornado ioloop directly instead of passing it from runtornado
(imported from commit ce901d7daca81bb1682827175bdcd83d3e5c2344)
2013-03-28 16:57:48 -04:00
Zev Benjamin 5b20dcf03c Add server-side event filtering based on type
Clients can now request to receive only certain kinds of events,
although they always receive restart events.

(imported from commit 1e72981f8fe763829ab2abde1e35f94cad5c34e4)
2013-03-28 16:57:48 -04:00
Zev Benjamin f2b1de7940 Apply events in register()
(imported from commit 4e30e52d968ceec596ecbabe71d4d9378cc8f7d9)
2013-03-28 16:57:48 -04:00
Zev Benjamin 4bc9152f71 Inform clients to reload via a 'restart' event sent on Tornado start up
(imported from commit 10bb45547ea0bf34e56fc620ecd7415bb8a825c5)
2013-03-28 16:57:48 -04:00
Zev Benjamin e4fba59538 Make event queues persistent across Tornado restarts using cPickle
(imported from commit 1434d1e9d394d725827b1740c0c07249d5e716ed)
2013-03-28 16:57:48 -04:00
Zev Benjamin 6cc70d94f6 Add register() call to event system
(imported from commit 0c9fbfec1866591b2169ce2da2bc2af6003f8f31)
2013-03-28 16:57:47 -04:00
Zev Benjamin 8f4eaa63ad Initial event system implementation
This version has several limitations that are addressed in later
commits in this series.

(imported from commit 5d452b312d4204935059c4d602af0b9a8be1a009)
2013-03-28 16:48:14 -04:00
Keegan McAllister 1ecc063d0f Split out source map processing into a library
(imported from commit 345efcc703dc1049e31fd38a6a062bf39a589eb6)
2013-03-28 14:56:52 -04:00
Tim Abbott 7685e47f07 Fix Tornado idle time logging.
When we added rabbitmq usage within Tornado, we inadvertently caused
the Tornado ioloop to be initialized in runtornado.py's imports,
before we overwrote the _poll method.  The end result was that we
weren't running the our instrumented Tornado poll function.

Fix this by moving that code to its own file which we import at the
top of runtornado.py, and adding comments documenting the situation so
we don't break this in some future import reorganization.

(imported from commit 016717476f10566fef4ed2b656f29f865d2084db)
2013-03-28 14:40:49 -04:00
Keegan McAllister 279f0b9842 Make it easier to find the source map for app.js
(imported from commit bca27c9838573fb4b74e2d269b253a48702c9e1c)
2013-03-28 12:11:23 -04:00
Keegan McAllister aa3c446665 Generate source maps from Closure Compiler
(imported from commit 0e4de860b1dba85aa43b60a2c819ac44403186c5)
2013-03-28 12:11:23 -04:00
Luke Faraone a49c37917a Implement generic rest_dispatch method for new API.
(imported from commit 912ee803db03098f195d18648ab98401915fead6)
2013-03-28 07:53:38 -07:00
Tim Abbott 78f5c2e877 Use the update_fields option to Django ORM .save().
This can result in a significant performance benefit because we only
need to update the columns that changed..

(imported from commit 42bef1fcc58ad79bd864f89263fe82e90743ee5b)
2013-03-28 07:36:11 -04:00
Tim Abbott a4383f8264 Remove batch_bulk_create helper function.
The behavior we require is now standard in Django 1.5.

(imported from commit 509adb0bd371081a2dad7d4a04d24fcffbda7cdc)
2013-03-28 07:36:10 -04:00
Tim Abbott e8aa77c9b4 Set timeouts for our memcached caches.
The policy this implements is:
* 1 week for most persistent data (Clients, etc.)
* 1 day for messages

(imported from commit d57bb2c6b9626ffa2155c6d0ef9b60827d1f2381)
2013-03-28 07:36:10 -04:00