Commit Graph

351 Commits

Author SHA1 Message Date
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
Tim Abbott e2d010ef2d Fix most unnecessary database queries in huddle creation.
This saves 2 database queries per user in the huddle when sending the
first message to a particular huddle.

(imported from commit f71aa32df846fb4b82651a93ff9608087ffcaa5a)
2013-03-28 07:36:10 -04:00
Tim Abbott 4502e563d1 Reduce code duplication for coding filling memcached caches.
(imported from commit e7e053c6fa27fd7a1143696196e9ee974ec91c8f)
2013-03-27 12:59:24 -04:00
Tim Abbott 8fbc98601b Populate cache of Huddle objects on server restart.
(imported from commit 3214cfa70d0de01c42028a9d025f7607f609081b)
2013-03-27 12:59:24 -04:00
Tim Abbott b2e76f50b9 Populate cache of Client objects on server restart.
(imported from commit 6d0ef309dadcd6c24fc9e17b0859becb053adccf)
2013-03-27 12:59:23 -04:00
Tim Abbott 36f09729e6 Run the memcached cache filling jobs in separate processes.
This will significantly improve the speed with which the memcached
caches are filled.

(imported from commit 445fec710a00b3d19b7962beddf89d4a75322eab)
2013-03-27 12:59:23 -04:00
Tim Abbott a774598a10 Populate cache of Recipient objects on server restart.
(imported from commit 752851c7c3ee565201dd59fb0455c82a8885d42d)
2013-03-27 12:59:23 -04:00
Tim Abbott cc065a3c90 Populate cache of Stream objects on server restart.
(imported from commit 131eeddc5ebe5cc0db2554514a730d2750078012)
2013-03-27 12:59:23 -04:00
Leo Franchi 79102044f4 Don't create a pika-connecting queue client if we have no RabbitMQ
(imported from commit 680e867abb61644cbc62a4280b4e47b03eb5abe7)
2013-03-27 11:06:10 -04:00
Tim Abbott f3ad2d7a6b Centralize dispatch logic for which queue processor to use.
Previous we had around 4 copies of the logic for deciding whether we
should publish data via a SimpleQueueClient queue, a
TornadoQueueClient queue, or to directly handle the operation, which
resulted in their getting out of sync and buggy (see e.g. the previous
commit).

We need to add a lock around adding things to the queue to work around
a bug with pika's BlockingConnection.

I should note that the previous logic in some places had a bunch of
tests of the form "elif settings.TEST_SUITE" for doing the work that
would have been done by the queue processor directly; these should
have just been "else" clauses -- since we generally want that code to
run on development environments whether or not the test suite is
currently running.

(imported from commit 16bdbed4fff04b1bda6fde3b16bee7359917720b)
2013-03-27 08:19:27 -04:00
Tim Abbott 16574806f5 Don't initialize SimpleQueueClient inside Tornado.
Previously we had several files which initialized SimpleQueueClient()
for sending items to the UserActivity queue, even though those code
paths aren't used outside Tornado.  This resulted in slower Tornado
startup times.

(imported from commit ad97021ec18d3927233744037c548c22db33c321)
2013-03-27 08:19:27 -04:00
Tim Abbott fde2243dbc [django 1.5] Update read flags handling to use new Django 1.5 syntax.
(imported from commit af1e2608b6d6d3677bf6266980d8dc77739aa4ba)
2013-03-27 08:19:26 -04:00
Jessica McKellar 0c3382fabb Always give hashlib.sha1 and friends bytes.
This fixes an experienced bug where you couldn't subscribe to a stream
with non-ASCII characters (failing with a UnicodeEncodeError), as well
as many other potential bugs.

(imported from commit f084a4b4b597b85935655097a7b5a163811c4d71)
2013-03-23 00:10:10 -04:00
Leo Franchi f64bc59dfb Automatically register consumer once asynchronous connection is completed
(imported from commit 3d860a9b79a42beffbd3b73f49aa2c25986dd3c6)
2013-03-22 15:55:49 -04:00
Leo Franchi 452105e393 Reconnect to rabbitmq in our queue client if the connection is lost
(imported from commit 82ed67f0c0f93e9f79ff65ef55b397815d20aaeb)
2013-03-22 15:55:48 -04:00
Keegan McAllister 4baeaaa532 TornadoQueueClient: Don't stop the Tornado I/O loop on RabbitMQ disconnect
Requires Pika 0.9.6 or later.

(imported from commit 316ab9f2a6b5c2a25ae8584e2604222b33e0dec3)
2013-03-22 15:55:48 -04:00
Keegan McAllister 6ffc2bbe65 TornadoQueueClient: Provide a callback when declaring queues
This is required by Pika 0.9.8.  We need at least 0.9.6 for the next
commit; I had been testing with 0.9.5 previously.  Anyway this way
seems more correct as well.

(imported from commit bfb9e9e78938073001f70c4d28a5e07cc4ebac32)
2013-03-22 15:55:48 -04:00
Keegan McAllister 23b8833ec5 Handle Tornado callback notify in a more generic, less HTTP-centric way
(imported from commit 85a74d1b40461236c4c95ad688e9796ab50f0bbf)
2013-03-22 15:51:23 -04:00
Keegan McAllister 373d3ece1c queue: Implement TornadoQueueClient
(imported from commit 2803bc91e42aa20d6e6dec87bfadd2f890268d05)
2013-03-22 15:39:07 -04:00
Jessica McKellar 37e58b613d Truncate the tutorial stream name to fit the DB max stream name length.
(imported from commit e267656337f97d3ea14e14e957a405cf4fd2d06c)
2013-03-20 10:15:08 -04:00
Leo Franchi c6f9dbdd54 Only sleep if there is more work to be done
(imported from commit f8a1380e0045c9470909c088a9d262f8a714c86e)
2013-03-19 09:55:12 -04:00
Leo Franchi 6d6c3364dc Rewrite message flag handling to fork out to a subprocess for batch handling
(imported from commit 1ef846f542950cabf32f8b176f5591cf5794a0ff)
2013-03-19 09:55:12 -04:00
Tim Abbott 9977cdde54 send_message: Save rendered message content to the database.
(imported from commit e5bd224687d5420f556b341286f03d3829973a3c)
2013-03-19 08:09:26 -04:00
Tim Abbott b38a538f8c Rename userprofile_by_foo cache keys to user_profile_by_foo.
(imported from commit ef398abc48c9b81a3d339ffdce00bae274246d28)
2013-03-18 16:15:11 -04:00
Tim Abbott 8034980cc4 create_mit_user_if_needed: Check memcached before querying database.
This will save at least one database query whenever MIT users send
messages.

(imported from commit 9fd644885a380463d841762b8fafe928431e1263)
2013-03-18 16:15:11 -04:00
Tim Abbott 97d7d31b68 Rewrite internal_send_message to use check_send_message.
This will automatically fix bugs such as one in which
internal_send_message didn't properly strip() the subject argument
before sending a message.

We change the recipient_type argument to internal_send_message to take
the recipient type name (e.g. 'stream') both to better fit the API and
also because the previous code incorrectly handled huddles.

(imported from commit 78c2596d328f6bb1ce2eaa3eed9a9e48146e3b6a)
2013-03-18 16:15:11 -04:00
Tim Abbott bb80d1c58c Move check_send_message and helpers to actions.py.
(imported from commit d74c90e25bd63931955d2ad9b3890be53d674a48)
2013-03-18 16:15:11 -04:00
Tim Abbott 9909c8dc19 send_message: Use a memcached for the UserProfile-by-id cache.
This cache should save 2 database queries whenever we send a private
message.  However, previously it was per-process (which meant it was
mostly useless) and also buggy (it never stored anything in the cache,
so that it was completely useless).  Switching this to our standard
memcached setup will address both problems.

(imported from commit 1d807f30704bccf28de33a80523488aedc58a9be)
2013-03-18 16:15:11 -04:00
Tim Abbott a23f6be28d Cache the results of Recipient queries in our memcached cache.
(imported from commit a6ba25a9c62d2738e4738b076370e4b2bc0ffaba)
2013-03-18 16:15:10 -04:00
Tim Abbott 9c2a9eb288 send_message: Avoid querying the stream object twice.
(imported from commit c23aab232a40195d92ae4b0e68af390c3b6b20ad)
2013-03-18 16:15:10 -04:00
Tim Abbott c6c3cda089 do_send_message: Save a database query on message sending.
(imported from commit c5dc3d9888f9b1867e8d20d84795dde32cf95583)
2013-03-18 16:15:10 -04:00
Tim Abbott 9ae583b910 Use the User/UserProfile caches for Django requests too.
Previously we only used these caches for Tornado requests, because we
were not updating memcached when e.g. the user's pointer changed, and
so functions like update_pointer would not work correctly.

Now that we are updated memcached when the User and UserProfile
objects change, we can use these for all requests.

This saves 2 database queries on every Django request to the server.

(imported from commit aa5bffd885d14bde38b95e80a226bd5ab66f253d)
2013-03-15 18:09:34 -04:00
Tim Abbott 1e6ed16c23 Flush the User cache when saving User objects too.
(imported from commit e595209fe1190e2f3e0d55ad3b9bae0997b91d1a)
2013-03-15 18:09:34 -04:00
Tim Abbott b6f42cb1e1 Update UserProfile objects in memcached when we save them.
(imported from commit 59426e19eeeba131f363a4bc5f74f59b6dbe1066)
2013-03-15 18:09:33 -04:00
Tim Abbott 7e456ddba7 Cache get_status_list output for up to a minute.
This should substantially decrease the amount of server load generated
by the userpresence system.

I tested that this indeed was indeed saving one query on
/json/update_active_status requests on my laptop with 2 users from the
humbughq.com realm logged in.

(imported from commit 03e9d4eb95b9f664d489862684ae162db2076e08)
2013-03-15 16:37:41 -04:00
Tim Abbott ec07184721 cache_helpers: Fill in memcached message cache in batches of 1000.
This cache filling code takes about 5 seconds to run, which means it
will finish before Tornado starts reading from this cache, but if that
were to change, it would be much better to have made at least some
progress.

(imported from commit 60a3420cdb9ddf331d83573a3fdb6be1a5ee5a4f)
2013-03-15 16:37:41 -04:00
Tim Abbott e78ef47487 message_cache: Query related models to avoid more queries later.
(imported from commit c1442165c68e9eef1cb5d310624c1021c1a57350)
2013-03-15 16:37:40 -04:00
Tim Abbott d88591c19c cache: Fix the select_related() query name for sending_client.
Previously we were calling select_related() on Message.client, which
doesn't exist.  It seems kinda poor that this doesn't raise an
exception.

I believe this issue was causing us to do very large numbers of
database queries during get_updates calls during server restarts.

(imported from commit b79bd698820fbd9dd82bd61fc175c32cd5ce6d05)
2013-03-15 16:37:40 -04:00
Waseem Daher 0f621f5f89 Show Twitter previews on production.
This reverts commit 4baed7ba22482eff6ed381d319f6e21da904d9ba.

(imported from commit dcab148b24e95f90edd5f2f3f581b4037deed787)
2013-03-14 18:00:04 -04:00
Leo Franchi 07433b80cc Don't mark your message as read if it comes from the API
(imported from commit 0570d4db590e21b0fadd544b10c9865fa7acd66b)
2013-03-14 15:51:21 -04:00
Tim Abbott 76837ebe2c fill_memcached_caches: Also fill the caches of User/UserProfile objects.
Since we flush memcached when we do a server restart, the flurry of
get_updates requests that fly in afterwards are all cache misses for
getting the User/UserProfile objects, so Tornado ends up spending
around 70ms per get_updates request rather than the usual 1-2ms.

So this should substantially improve our Tornado performance around
server restarts.

(imported from commit 07b8126bdfd4ff14e4c3362f9eda1fe5fd571c5b)
2013-03-14 15:07:42 -04:00
Tim Abbott cf58ee833a Rename lib/message_cache.py to lib/cache_helpers.py
(imported from commit 591e427aee47aea58b50d6c3fbd6a05cfe9378ea)
2013-03-14 15:07:41 -04:00
Tim Abbott adb9c88151 message_cache: Clean up populate_message_cache.
(imported from commit a73e4fc4908d840f4f02aef13a9afe2fb683fd83)
2013-03-14 15:07:41 -04:00
Tim Abbott 0a9a553b5f Fix use of invalid hash keys with memcached.
Email addresses can contain characters that are not valid for
memcached cache keys.

(imported from commit d7cfd6d5292e4fc8f4e2b19f2c01a4097d878f1b)
2013-03-14 15:07:41 -04:00
Tim Abbott c098520bbd Move the key functions for various caches to cache.py.
(imported from commit b04826533c32516cc2eef3b35263a40385ae7be4)
2013-03-14 15:07:41 -04:00
Tim Abbott 1580386946 Replace db_cache_with_key with a parameter on cache_with_key.
(imported from commit f2c600292888ba384ee4acc97c94f1d6f8bc9657)
2013-03-14 15:07:41 -04:00
Waseem Daher 9c45b96b21 Make Dropbox inline image preview more robust to sharing links.
Sometimes Dropbox shares with /s/ and sometimes with /sh/,
and I'm not sure which controls it, but we should deal with both.

(imported from commit 2222450f25c418b5fbd60ab2c30477467e34c0d1)
2013-03-13 17:46:43 -04:00
Leo Franchi 93a3f14c43 Add backend support for handling new 'read' message flag
(imported from commit 6194e9332caa2d279cbc304f0d6a69f969aa9a72)
2013-03-13 14:14:45 -04:00
Tim Abbott 275af189a3 Cache permanent errors from the Twitter API.
This avoids our repeatedly retrying to fetch a tweet that doesn't
exist from the Twitter API.

(imported from commit b4ca1060d03da21e7e59e5b99e682d2e8457df15)
2013-03-13 11:12:25 -04:00
Leo Franchi 2c4c6ba43e [schema][manual] Add South migration for flags on UserMessage
(imported from commit bdf6cf2d5427709e52ef051e3c4a19c5fbb4851c)
2013-03-13 10:20:56 -04:00
Waseem Daher a57afd9a63 Use separate Twitter API key for prod.
(imported from commit ab43b42f69eaa569cf7a1ccba9f15d528050c22b)
2013-03-12 18:28:59 -04:00
Jessica McKellar a8d6bd3322 Remove some unused imports.
(imported from commit bb8311848ca24fbb1fb1b3df8f8b4403eb38ce1c)
2013-03-11 16:47:03 -04:00
Jessica McKellar 2314809d73 Auto-color streams.
(imported from commit b669f864b0574e9e9af282ccb8783ccfaa12adfd)
2013-03-11 16:47:03 -04:00
Waseem Daher 3c6d489064 Don't do Twitter previews on prod.
(imported from commit 4baed7ba22482eff6ed381d319f6e21da904d9ba)
2013-03-11 15:18:57 -04:00
Tim Abbott d679a72952 [manual] Cache results of the Twitter API in the database.
This should substantially improve the repeat-rendering time for pages
with large numbers of tweets since we don't need to go all the way to
twitter.com, which can take like a second, to render tweets properly.

To deploy this commit properly, one needs to run

./manage.py createcachetable third_party_api_results

(imported from commit 01b528e61f9dde2ee718bdec0490088907b6017e)
2013-03-11 13:15:55 -04:00
Waseem Daher 29d504149c twitter: Only render the first Twitter link we see, not all of them.
(imported from commit 68582224962da14795d91a68197db1001ae7b75c)
2013-03-08 17:45:58 -05:00
Tim Abbott f37c6e7a1a do_create_realm: Use internal_send_message.
(imported from commit 92edff133d16f72cf954671392e413066fb22955)
2013-03-08 17:24:33 -05:00
Tim Abbott a6c461e3e0 internal_send_message: Render content before sending.
(imported from commit 00b80c71ccf5b1388d64cf8b6a2cb21b818ece4a)
2013-03-08 17:24:33 -05:00
Tim Abbott 254bc9f361 Attempt to render messages before accepting them from the user.
This fixes trac #407.

(imported from commit e33647eec32266790f864d14ad377d51956d2a6f)
2013-03-08 17:24:33 -05:00
Tim Abbott 2f022ebb34 bugdown: Allow caller of convert to tell whether we succeeded.
(imported from commit 9e3cab73e0d9e9ad31ba770210e535584cca3bb2)
2013-03-08 17:24:33 -05:00
Waseem Daher 0e2e754c3d [manual] Use Twitter API v1.1 for inline previews.
This commit adds a dependency on python-twitter,
whose upstream is at https://github.com/bear/python-twitter,
and which for now needs to manually be installed on our
servers from the Debian package in sid.

(imported from commit 80cd9f4f59a6f0de6b75ac95e412c69e2a2e2490)
2013-03-08 17:10:06 -05:00
Waseem Daher 1df648baa9 Add inline preview of Twitter links.
This uses the unauthed v1 of the Twitter API, which is going to go
away soon, but it's fine as an interim measure.

(imported from commit 709a250271321f5479854a363875c9da43e6382d)
2013-03-08 14:31:18 -05:00
Tim Abbott 4ab5cabb80 bugdown: Split out iteration through a tree into helper function.
(imported from commit ba73832c61eccdefe45f8e0d935216e6cc431176)
2013-03-08 14:31:17 -05:00
Waseem Daher 4ea7ac102f Allow internal_send_message to send cross-realm stream messages.
Prior to this change, any stream message sent by internal_send_message
could only be in the realm of the sender.

This was a problem most notably for... the tutorial bot, with the
hilarious consequence that the tutorial worked fine in humbughq.com,
but failed to start anywhere else.

(imported from commit 33a904a28e3a57e1a2cf9172c2e2a75b50967a50)
2013-03-06 23:04:57 -05:00
Reid Barton bc0dbbb566 Detect image-ness by end of path component, not end of entire URL
(imported from commit 9dd2e9c7273d3c7d071a8e5f82014e28b2a99ee4)
2013-03-06 19:02:29 -05:00
Tim Abbott acab720502 Add support for making Tornado dump its stack via SIGUSR1/2.
With this change,

pkill -SIGUSR1 -f runtornado

will dump the stack and SIGUSR2 will enable an interactive debugging
session.

This fixes #613 for Tornado which was the original motive for that
ticket; I'm not sure whether we want to do this for our Django
processes as well, but it would be easy to do so if we did.

(imported from commit a7de7c6070f4bf0404bed6f434e6a6b291d66a26)
2013-03-06 14:19:32 -05:00
Jessica McKellar ac305ffc1d Add a management command to deactivate a user.
(imported from commit 14ef58bdd2cd20c05c68cd53cf911711d3bdb5fd)
2013-03-06 11:57:04 -05:00
Waseem Daher 0dee6235cc Don't image-ify :( and other smileys 😞
(imported from commit 25323f19572c24da36267064a1ca820d80c9db79)
2013-03-05 16:22:51 -05:00
Waseem Daher 9f0877a7f2 Add emoji support 👍 🎩 💩 😀
(imported from commit 5f15ddb4492aad7cc4a9b3249acac8b8edc0a177)
2013-03-04 11:08:00 -05:00
Waseem Daher 1650dba322 Intelligently preview Dropbox image links.
Even though they look like images, they're not -- you need to
append ?dl=1 to get the image version.

(imported from commit 2a05e7c58f475c908687110d9191f8709425c660)
2013-03-04 10:38:42 -05:00
Tim Abbott 02bf89c3c3 Add inline previews for images and youtube videos.
(imported from commit 13711a7821318c8bff7c483e874756a63d761c15)
2013-03-01 14:21:35 -05:00
Tim Abbott 1e9a85ff05 Fix use of case-sensitive comparisons on email addresses.
(imported from commit d420169640a9f9c034b3d9ded207e583691f6652)
2013-02-28 17:49:57 -05:00
Jeff Arnold fcd033e33e [schema] Save enter_sends on the server in the database.
(imported from commit 4d82f6aaf5918f155a930253c9cc334dbcc0d97a)
2013-02-27 17:25:29 -05:00
Keegan McAllister 29b98e5546 Display invalid links as plain text rather than linkifying with empty href
Fixes #1001.

(imported from commit 116df72f37e45dd87c34cd836918dd559630fe76)
2013-02-27 11:29:05 -05:00
Keegan McAllister 75704ad1e8 Consistently use #!/usr/bin/env python
At Ksplice we used /usr/bin/python because we shipped dependencies as Debian /
Red Hat packages, which would be installed against the system Python.  We were
also very careful to use only Python 2.3 features so that even old system
Python would still work.

None of that is true at Humbug.  We expect users to install dependencies
themselves, so it's more likely that the Python in $PATH is correct.  On OS X
in particular, it's common to have five broken Python installs and there's no
expectation that /usr/bin/python is the right one.

The files which aren't marked executable are not interesting to run as scripts,
so we just remove the line there.  (In general it's common to have libraries
that can also be executed, to run test cases or whatever, but that's not the
case here.)

(imported from commit 437d4aee2c6e66601ad3334eefd50749cce2eca6)
2013-02-20 16:02:30 -05:00
Tim Abbott 9ef3754682 Use bulk_create to create sent messages.
Previously we were doing 100 queries for new messages being sent to
the main hacker school channels; they were faster than many similar
instances because they were all done within 1 transaction, but still,
send_message_backend would be spending up to 200ms (and 148 queries)
querying the database with the previous code on prod; this new version
should do a fixed number of database queries per message.

(imported from commit 3799e63aebb6f017932ddb0fe1f6209281c0ddcf)
2013-02-19 17:36:22 -05:00
Tim Abbott d364e450ea Move create_user to its own file.
(imported from commit b3dc11d3730634b35256dca940d479a81441c062)
2013-02-19 17:36:22 -05:00
Leo Franchi 49328c2551 Unify rabbitmq usage to use only one queue.
To work around the issue we're having with queue draining between
parallel blocking connections, use the same rabbitmq queue for both
activity and presence events, keyed on a 'type' flag in the message
itself.

(imported from commit 188e8fda1695734e52c5740db2195072cfc81479)
2013-02-15 11:43:17 -05:00
Leo Franchi d4a582fa1c Handle SIGINT and SIGTERM in process_user_activity by closing communication gracefully
(imported from commit dcf813fa8af1aaf5d6cc635268757e40c6c202ab)
2013-02-15 11:05:31 -05:00
Leo Franchi c2074813ca Generate unique consumer tags when connecting to the queues
(imported from commit cd9c78db46ae1a36b46bebf5cb0d226e15f71ba4)
2013-02-15 11:05:31 -05:00
Leo Franchi 5d82dc5ce2 Don't match ** for strong across newlines
(imported from commit e3bc0b409bd99c3707746c23eb73e11342cfe178)
2013-02-14 11:56:53 -05:00
Tim Abbott 2f4b62048e gather_subscriptions: Fix making O(streams) database queries.
This cuts the MIT Zephyr home page load time and also #subscriptions
database-sourced load time for me from about a second to about 50ms on
my laptop.  The home page still takes about 600ms to load due to
templating.

(imported from commit 1cfd8c750301abe6b6a881be4b2857532be947ec)
2013-02-12 16:25:45 -05:00
Leo Franchi 168f8623e4 Add https?: greedy url matching before falling back to our url guesser
(imported from commit 9e6e5a0522e6501b354a56223c2639841d290d4b)
2013-02-12 12:24:15 -05:00
Leo Franchi 7af226398e Only connect to RabbitMQ if it is enabled
(imported from commit 9726595bbb850c903177b5f64612eb4aa82e36ce)
2013-02-12 12:12:28 -05:00
Leo Franchi c348dd3587 Remove get_instance() from SimpleQueueClient
SimpleQueueClient was not thread-safe as the pika method
calls that we are using might disconnect and end up in a bad
state if two threads enqueue messages at the same time.

In order to avoid this, each user of the rabbitmq queue
gets its own instance of a SimpleQueueClient.

(imported from commit 694083b75cd58a60b8de282a8f40eb92a864c5ce)
2013-02-11 18:05:57 -05:00
Leo Franchi 0a0c4bb9a0 [manual] Use rabbitmq for asynchronous presence updating
Note: When deploying, restarting the process-user-activity-commandline script is needed

(imported from commit 63ee795c9c7a7db4a40170cff5636dc1dd0b46a8)
2013-02-11 18:05:57 -05:00
Leo Franchi 31f87481d0 [manual][schema] Add an API for user presence (idle) information
Adds a new db table for storing presences, and an API for setting
an individual user's idleness as well as fetching all idle status
for all users in a realm

(imported from commit 5aad3510d4c90c49470c130d6dfa80f0d36b0057)
2013-02-11 18:05:57 -05:00
Jessica McKellar 53f0b00785 Add a management command to change and log user emails.
(imported from commit 0bf25433a371f7e46ade96019f4a9ceebe395fe5)
2013-02-10 16:45:25 -05:00
Keegan McAllister 9edb616feb queue: Add logging
(imported from commit db2f15cf5f6a683f03d08a2e8b8ee4547537daf7)
2013-02-08 13:57:22 -05:00
Keegan McAllister 89c544f21f queue: Refactor SimpleQueueClient initialization
In anticipation of subclassing.

(imported from commit 1ebee932aed1b472bf9a8ab6d9bc30519f587c83)
2013-02-08 13:57:22 -05:00
Keegan McAllister d349de903b queue: Get rid of lazy initialization in SimpleQueue
Instead make it a singleton with a get_instance() class method.

(imported from commit e32cabf77b43361e74a11a23bba3a6d9fb32f82f)
2013-02-08 13:57:22 -05:00
Keegan McAllister b2bc7941dc queue: Use normal instance data in SimpleQueue
Code like this is dangerous:

    class SimpleQueue(object):
        queues = set()

because all instances will share the same 'queues' set object.

We don't really need multiple instances, but neither is there a reason to break
them.  So do the normal Python thing instead.

(imported from commit a56bb8414dd549cfd312c9565df198cf9d20f08a)
2013-02-08 13:57:22 -05:00
Keegan McAllister f14db52f22 queue: Rename SimpleQueue to SimpleQueueClient
It doesn't represent a single queue; that's what the 'queue_name' arguments are
for.

(imported from commit 8382ae6793ca7c3ae4b5aacf2c128113a7a88fb6)
2013-02-08 13:57:22 -05:00
Keegan McAllister 2617bbcdff queue: Remove shebang line
There's no reason to run this file as a script, and it's not marked as
executable.

(imported from commit 52bddaf2b59333c1f37b2cfc90b92a164c2e6d3c)
2013-02-08 13:57:22 -05:00
Jessica McKellar ad8e9598f6 Log domain in do_activate_user.
(imported from commit 0e39b5ddc395ff245f8e3b0252ea3b33a90860f1)
2013-02-08 13:20:19 -05:00
Jessica McKellar 50bab7af8f Log domain in user creation event.
(imported from commit d5aca898781b4f33a749536181e50f941bd16b59)
2013-02-08 13:20:19 -05:00
Leo Franchi c637b9cf44 Handle chars at end of link better
(imported from commit 53842bc17bbb9cfb555738ee6b72291d7ce61d67)
2013-02-06 11:51:52 -05:00
Waseem Daher 66850b5dcd Make gather_subscriptions pass along whether or not a stream is invite-only.
(imported from commit f71c171185a0552dba4917967d3feffb9c92c4fe)
2013-02-05 17:24:29 -05:00
Luke Faraone ac0dbd0864 Return in_home_view in gather_subscriptions.
This enables us to do client-side filtering on messages by the value of
this setting.

(imported from commit e69a7772dc90c67cb91ea8f630f5b78c902e8fa8)
2013-02-05 15:34:37 -05:00
Luke Faraone e8afaa8b8e Return a dictionary in subscriptions/list instead of a tuple.
This will give us flexibility in the future to add new properties to the
list.

In order to support that, we now do a list comprehension rather than just
returning the gather_subscriptions list in get_stream_colors.

(imported from commit a3c0f749a3320f647440f800105942434da08111)
2013-02-05 15:34:37 -05:00
Leo Franchi 054420fc38 Match .co.uk before .co in linkification
(imported from commit 2461cb4d49eef15431dde30dda646b25dc860a7b)
2013-02-05 13:04:45 -05:00
Jessica McKellar fdb0d15080 Don't let non-subscribers of invite-only streams query the membership.
(imported from commit 01bd8ea089dec96e487e5e82fb38df65703679ae)
2013-02-05 10:12:04 -05:00
Leo Franchi 3569e8e9b2 Sanitize links to prevent XSS, and handle emails
(imported from commit 622396efde50d9f5e3501f5d780c344ad0692662)
2013-02-01 18:42:27 -05:00
Leo Franchi cc58044234 Rework linkify regex to match more urls
(imported from commit 0e1a1df88363374ffbc802f83f43eb0fac8c99ea)
2013-02-01 16:14:29 -05:00
Keegan McAllister d348e0e9d6 bugdown: Disable italics and __foo__-style bold
(imported from commit c35d6980db6c59828514a90eec199a7494625495)
2013-01-31 16:28:57 -05:00
Leo Franchi 071ea3b9a4 Send humbug & email on markdown parse failure
(imported from commit c132ab91f1ff9ffdbe5f740980bf362b16c6bba6)
2013-01-31 14:48:40 -05:00
Keegan McAllister c5a69e5814 timeout: Try to kill the thread once the timeout expires
(imported from commit 25e19a3baa306fb440b27f492506ff231681bb4e)
2013-01-30 11:13:48 -05:00
Keegan McAllister e12f10ec1f bugdown: Spend at most 5 seconds rendering a message
(imported from commit bc092acc8b2b9f8a63af669de06c6f7512ccf8c9)
2013-01-30 11:13:48 -05:00
Leo Franchi 6130d271cf Make fence regex stricter to only match fence-like things
(imported from commit 59d5302b7af09c669423d364d46fb0d1b6a7b080)
2013-01-29 18:02:46 -05:00
Leo Franchi c6f73f7697 Refactor fence block code to never infinite loop
(imported from commit f72cb182e4fc9c4e8003853276d8aa40b454d08f)
2013-01-29 18:02:45 -05:00
Keegan McAllister f2659b7dcd bugdown: Remove dead code
The user of this function was removed in 97dd20ec.

(imported from commit c3823df65172f3799658e36d7ba183f661e9fe65)
2013-01-28 18:37:48 -05:00
Leo Franchi 7e567f527f Move gather_subscriptions to actions.py as it's not a view
(imported from commit cdf94ded51e441fe3515641458023be44c1ba40c)
2013-01-28 17:32:58 -05:00
Leo Franchi c39c6f643c Handle lists that start immediately after paragraphs
(imported from commit 055593d7a324598e133d53db0c33103016426c8f)
2013-01-25 17:13:13 -05:00
Leo Franchi 969d89d070 Don't accept - as valid list delimiters
(imported from commit 287353a29289ee536a59f47f87ff66893bf261ec)
2013-01-25 17:13:13 -05:00
Leo Franchi ba7dcc320c Remove ``` support from code fence
Supporting ``` as a code fence marker complicates the auto-fence
closing, and as per a discussion with Keegan on code-review@, it
is not worth the extra complexity.

(imported from commit 405afb95c4295a02f4677181456caf9d49913ac4)
2013-01-25 17:12:49 -05:00
Leo Franchi c2db0dd8bf Automatically add an end-of-code fence block if missing
(imported from commit 167f0217bbe6709e73dbc06f2894d9e22ee17a77)
2013-01-25 17:02:57 -05:00
Leo Franchi b2505bfc22 Add backend support for invite-only streams
Trying to add a user to an invite-only stream that already
exists will result in in error

(imported from commit 910750580a122cee92096d7e83457cb0b8cce616)
2013-01-24 17:34:21 -05:00
Tim Abbott 748927ad7c Fix transaction management in create_mit_user_if_needed.
(imported from commit 063eaf5180964ad32a6feb3c899a4cc5beea6fe9)
2013-01-24 10:58:51 -05:00
Reid Barton c9e2fed3f9 Preparatory changes to Tornado server for receiving a single stream's messages
Doesn't yet add the API for actually doing so.

(imported from commit a2062d71544441256a41f817388bb0c7ea6891ff)
2013-01-16 14:19:05 -05:00
Keegan McAllister b5a0147e26 Log events to a file named after today's date
We need this so that we can safely expunge old events without interfering with
the running server.  See #414.

(imported from commit 4739e59e36ea69f877c158c13ee752bf6a2dacfe)
2013-01-15 14:37:36 -05:00
Tim Abbott e592e71515 [manual] Use rabbitmq queue to process UserActivity.
Before this is deployed, we need to install rabbitmq and pika on the
target server (see the puppet part of this commit for how).

When this is deployed, we need to start the new user activity bot:

./manage.py process_user_activity

in the screen session on the relevant server, or user_activity logs
won't be processed (which will eventually result in all users getting
notifications about how their mirrors are out of date).

(imported from commit 44d605aca0290bef2c94fb99267e15e26b21673b)
2013-01-14 13:28:23 -05:00
Tim Abbott 6a2bf7c4f3 Move update_user_activity to actions.py.
(imported from commit a81669d01e699fbf809a02f91e6007b7f61e5518)
2013-01-14 13:28:23 -05:00
Luke Faraone 155cd1e821 Reintroduce updated internal_send_message to support sending personals.
internal_send_message now has the ability to send personals as well as
stream messages.

This change was accidentally lost during a rebase.

(imported from commit 153a3929c5c64be82288293c1f0cc02fcc03c08d)
2013-01-14 12:41:18 -05:00
Tim Abbott 47b2b1cb1c tornado: Fill the message memcached in a child process.
(imported from commit 3a7b4c0f4aad37319f4cfa7892709e99883f6a87)
2013-01-14 12:28:51 -05:00
Tim Abbott e36fd4b817 tornado: Send rendered messages to Tornado via memcached.
(imported from commit c1e8a017fa61b4e3f5c44ad4e5f59e4faf012ca3)
2013-01-11 16:11:07 -05:00
Tim Abbott a058471a56 tornado: Cache messages internally in tornado process.
This allows us to handle the return_messages_immediately part of
get_updates requests without having to talk to the database.

(imported from commit ed0b7742d359efb21a0a4960f4fc25f4337e9ad4)
2013-01-11 16:11:07 -05:00
Tim Abbott 1a82741650 Move action functions from models.py to zephyr/lib/actions.py.
(imported from commit 9d577dd53ce7d4c9faf6cc8a56129d684a50811b)
2013-01-11 16:11:03 -05:00
Tim Abbott 761b7cd5fa Rename zephyr.lib.time to zephyr.lib.timestamp.
Otherwise one gets:

AttributeError: 'module' object has no attribute 'time'

when trying to use the time module from inside zephyr.lib.

(imported from commit 645368672a3eff68320278dd480edeed56721fcc)
2013-01-11 15:58:19 -05:00
Tim Abbott 3c10a2e6a0 Move bulk_create_* methods to bulk_create.py.
(imported from commit 30d5f86209f9c8807516f0440276fafeb6590c1a)
2013-01-10 16:59:36 -05:00
Tim Abbott 7cebbd4a52 Add datetime_to_timestamp library function.
(imported from commit 28466ac5c8fc406ec70a61cae5975a784eb0f238)
2012-12-12 15:45:37 -05:00
Tim Abbott 02d65664b4 Increase MySQL batch size to 10,000.
This saves 30 seconds in populate_db runtime on MySQL.

(imported from commit 7fe483bf5f32cfa3d09db8ad7a9be79bd0a2a271)
2012-12-11 17:17:38 -05:00
Keegan McAllister b283123382 bugdown: Remove special treatment of backslash
Fixes #562.

(imported from commit aa39cf390ef44275c7d5a84ca954c75535d372b1)
2012-12-11 16:54:10 -05:00
Tim Abbott 970969fc44 Add new timestamp_to_datetime helper function.
(imported from commit 6791d009ae2e8371abe2c929e87c816a1981f5fe)
2012-12-05 15:34:19 -05:00
Keegan McAllister 6d9e0095eb bugdown: Disable reference-based links
This is syntax like

    Here's [a link][]

    [a link]: http://google.com

This is not very useful for short chat-style messages.  It will confuse users,
especially because we don't document it.  And disabling it saves the effort of
applying the same link fixups as elsewhere.

(imported from commit c23391465486db545302b79c084b4f9cd5cdcc6a)
2012-12-05 13:54:43 -05:00
Keegan McAllister fb77bdf359 bugdown: Set link target, title attributes on the server
For consistency.  Fixes #266.

(imported from commit 63e199a0fe4534df804a82cc98a1fdcf8ccb45da)
2012-12-05 13:54:43 -05:00
Keegan McAllister 80d07f597b bugdown: Ignore user-specified link title
We already override this client-side.

(imported from commit c9569d42d57f206e5fb7d0cc8569b3b578ac1467)
2012-12-05 13:54:43 -05:00
Keegan McAllister 3829c8fd7f bugdown: Assume http:// for links without a protocol
It's unlikely that users want relative links within humbughq.com.

Fixes #447.

(imported from commit d43a5758e6df448b07f56dc2de28078adaab8aeb)
2012-12-05 13:54:43 -05:00
Keegan McAllister d8b6cfdc11 bugdown: Fix confusing variable use in LinkPattern
(imported from commit 1538911149263340a5ea210c6d804a937f07cd5e)
2012-12-05 13:54:43 -05:00
Keegan McAllister b577bd54cd bugdown: Remove code path to bypass sanitize_url
(imported from commit 984b87027cb56fe75c2dd9dcf505dde5bc624f8f)
2012-12-05 13:54:43 -05:00
Keegan McAllister 8b3cfc0f1b bugdown: Use a local copy of markdown.inlinepatterns.LinkPattern
With changes for the way things are imported in bugdown.

(imported from commit 11adf7911f7bb945367221f8fa317caa71de3fc4)
2012-12-05 13:54:42 -05:00
Keegan McAllister ff040faf97 bugdown: Use Markdown.reset() instead of re-creating the whole parser
(imported from commit 45a65453f2178a6a73392e2bd1e7d6d03de0e0e7)
2012-11-20 15:10:15 -05:00
Keegan McAllister fc60543432 bugdown: Remove trailing punctuation from automatic links
And allow parentheses etc. within a link, if they're not at the end.

Fixes #401.

(imported from commit 5261fce74fe381ceece2e7406776cc5bde19deb9)
2012-11-20 15:10:15 -05:00
Keegan McAllister ba40bd390b bugdown: Use our local copy of fenced_code
And wire it up to our local copy of codehilite.  This fixes highlighting in
fenced code blocks, e.g.

~~~~ .js
var x = function () {
    return "hi";
};
~~~~

(imported from commit 0efb0c9b98a3acdf55e18bb1918af7960f3425be)
2012-11-19 13:04:40 -05:00
Keegan McAllister 7d08c405f3 Import GitHub version of Markdown fenced_code extension
(imported from commit 929de2ba09a5c6dabed20c7f1b3ba319ba42b244)
2012-11-19 13:04:40 -05:00
Keegan McAllister 45cb7c1d37 bugdown: Don't guess code highlighting language
Disables highlighting unless a language is specified.

(imported from commit fe5d1a4a8042241336ee7ac01682553f6b35e956)
2012-11-19 13:04:40 -05:00
Keegan McAllister 1ea92c0953 Manage file locking using the 'with' statement
This is clearer and more exception-safe.

(imported from commit b67641b05da9dbf8e5a887f398bac81ab5985cf3)
2012-11-16 13:43:44 -05:00
Zev Benjamin b278db110f Move json response functions into their own file
(imported from commit 91a786849bfa30dcacecef6b8339d8f1a9365156)
2012-11-08 16:30:57 -05:00
Zev Benjamin 7bbde14d78 Use functools.wraps on the functions returned by our decorators
This lets Django report the correct view name in errors

(imported from commit b21347e7af39cda439125355f99f4fc63fc3bd2f)
2012-11-08 16:30:57 -05:00
Tim Abbott 95c39cbc76 bulk_create: Use a (large) batch_size with MySQL.
(imported from commit 529fef7dd55bb8a5f4e286f7c896f4b14b0d1b8d)
2012-11-07 15:49:45 -05:00
Keegan McAllister b87a35c1ff bugdown: Disable + as a bullet character for an unordered list
Fixes #272.

(imported from commit 8afaf14965ed1f6a4bb3ccfc9d4c2d807148666d)
2012-11-02 14:04:09 -04:00
Keegan McAllister 7a6fe207c5 bugdown: Disable ordered lists
These get automatically re-numbered, which will do the wrong thing when people
split their lists across multiple messages.

Fixes #241.

(imported from commit 7f6f2c36a6ab27cef0a34008f304fc0fe25c8bd0)
2012-11-02 14:04:09 -04:00
Keegan McAllister 1d4f339eae bugdown: Hide alphanumeric characters in exception logs, for privacy
(imported from commit 39481494b7910307f56e566035c1b464c83d196e)
2012-10-25 15:40:01 -04:00
Keegan McAllister eef027560a Remove unused imports
(imported from commit eb576627ff72e57fee0e3a4c357f51ad74cd6c86)
2012-10-25 15:22:18 -04:00
Keegan McAllister 26c97729d4 bugdown: Generate HTML, not XHTML
Our pages are declared as HTML5:

    <!DOCTYPE html>

The markdown library only supports HTML4, but that's probably closer than XHTML.

(imported from commit c78be9ae9bccf029def8d94d3647b0ccce8b2252)
2012-10-24 16:02:15 -04:00
Keegan McAllister 4ca720a0cd bugdown: Install autolink pattern after link pattern
This fixes explicit links.

(imported from commit 6867d271344d35c2c8d54b3393219113a095bc4f)
2012-10-22 17:48:48 -04:00
Keegan McAllister 05c08b41c4 bugdown: Disallow ()[]{}<> in linkified URLs.
This allows us to handle messages like

    my website (available at http://google.com)

(imported from commit 51330507947fc039b6f29f06dfa1c6d21f779aa4)
2012-10-22 17:32:39 -04:00
Keegan McAllister 1c4bbd6a49 bugdown: Start a URL with a word boundary, not a space
This fixes the bug where we were eating the preceding space.

(imported from commit 9eca01e6ad828ccc31ad10693339f381333e76a7)
2012-10-22 17:32:39 -04:00
Keegan McAllister 189d42428a bugdown: Log Markdown parser failures
(imported from commit 9e225a32b71edbfd9007cc2fbae32be31896233d)
2012-10-21 23:07:03 -04:00
Keegan McAllister 4a0cf8e608 bugdown: Disable builtin 'autolink' feature
This only linkifies inside angle brackets, per

    print md.inlinePatterns['autolink'].getCompiledRegExp().pattern

We have our own linkification extension.

(imported from commit 20cab11aaafee075e0caf933d8d197717976988c)
2012-10-21 21:03:18 -04:00
Keegan McAllister 00a4da5f9b bugdown: Disable automatic mailto links for <foo@bar>
This feature was throwing exceptions on input like

    <@`x`>

Reported upstream as https://github.com/waylan/Python-Markdown/issues/155

(imported from commit 6b14a65599def0346f76cf017be66dd80f42db49)
2012-10-21 21:03:18 -04:00
Keegan McAllister 4db8587805 bugdown: Decrease code duplication
(imported from commit 40158134b60e477d8a353d050fa62c9ded0e9e9f)
2012-10-21 21:03:18 -04:00
Keegan McAllister 649cd15415 bugdown: Linkify using a Markdown extension
This prevents trying to linkify inside code blocks.

(imported from commit 97dd20ecee19f41650aa98e68aa8e9908ece5b33)
2012-10-21 21:03:15 -04:00
Keegan McAllister d72aea25f2 bugdown: Use named match for Gravatar email
(imported from commit 778c4b6d754f975c89a91336593d2f62e49249d5)
2012-10-21 20:16:07 -04:00
Tim Abbott d68cf3696b populate_db replay: Use bulk_create to create objects.
This cuts the time required to import 38000 messages (with 140000
message receipts) from about 10 minutes to just under 40 seconds on my
laptop with sqlite.

(imported from commit d53b0d1360408c77f38353b58fbb25875262cb40)
2012-10-20 18:26:18 -04:00
Keegan McAllister 61a33f4c4d bugdown: Disable line numbering of code blocks
Pygments renders these using tables, which breaks our client's assumptions
about what <tr>s mean.

(imported from commit 46d37395785e06fb183d17b08afed4c6f5957baa)
2012-10-19 23:54:10 -04:00
Keegan McAllister dc8bc9e1af codehilite: Allow the caller to disable line numbering
(imported from commit 4257cc1b8b1e2a78cb36d4fdf105a5864c1b20fa)
2012-10-19 23:54:10 -04:00
Keegan McAllister 0edbc80616 Use our local copy of codehilite
(imported from commit bc9704a19017061d55ff0e16589d57ee0c46caa5)
2012-10-19 23:50:32 -04:00
Keegan McAllister 5e1654b9b5 Import GitHub version of Markdown codehilite extension
(imported from commit 166f85fabf8a80858240c2610437002e49f98278)
2012-10-19 23:30:47 -04:00
Keegan McAllister 086e1b1c33 Make bugdown able to contain sub-modules
(imported from commit 6fa5a6cd8f972e3afb21b65bdfca927e824194aa)
2012-10-19 23:30:14 -04:00
Keegan McAllister c851bc4632 Generate initial API keys in the same manner as passwords
(imported from commit 754fa391b441c520082650a0cf3bacf050bf81b3)
2012-10-17 18:23:01 -04:00
Keegan McAllister cc8a14fcf8 Create accounts with passwords which are deterministic but hard to guess (from the outside)
(imported from commit 964610fec6c4690c1e881f2bab252296663c819a)
2012-10-17 18:23:01 -04:00
Keegan McAllister c31462c278 Allow users to embed Gravatars in messages
We'll use this internally for the commit bot.  We might eventually disable it
for external users.

(imported from commit 3136cd9faadc6b81355889d2ee6472985da87fbe)
2012-10-17 01:11:33 -04:00
Keegan McAllister 81f0d61c3b Factor out Gravatar hash calculation
(imported from commit 29872722fb4856773d98fc987a1e2d6eb99ad8b2)
2012-10-17 01:09:16 -04:00
Keegan McAllister ed094b6a84 Markdown: Disable headings using our extension
(imported from commit cd40f6bf010ff30775ca2af494b9566843444797)
2012-10-16 11:39:00 -04:00
Keegan McAllister d8556707aa Markdown: Disable images
(imported from commit 6656b15fa690b463265af6384a73529ee635f688)
2012-10-16 11:35:58 -04:00
Keegan McAllister fa729c838a Move our various Markdown hacks into their own file
(imported from commit b03a5c64cc95964936c4aba7d667807969e35d21)
2012-10-15 16:16:09 -04:00
Keegan McAllister d91ec7056f Add a Django query helper
(imported from commit cf1f87eb4fb2b6f44ec0ebafc4cad8dcc9bc5e5c)
2012-09-28 19:33:15 -04:00
Keegan McAllister 669bb789f8 Add caching decorators
(imported from commit 7a4d9257ea8c6a86a5ffb498f726c4c2eb42bc9f)
2012-09-19 13:01:58 -04:00