Commit Graph

300 Commits

Author SHA1 Message Date
Keegan McAllister 51a96484f9 Consolidate callback code
(imported from commit e79ea42df3506bedd2077dcc63a45d32fe7b73de)
2012-11-08 10:47:09 -05:00
Keegan McAllister 9b9373d2ba Make callbacks_table class data rather than global
(imported from commit 39699304255b475ccab8a4760b155f3307cfe5d9)
2012-11-08 10:47:09 -05:00
Keegan McAllister f89366f5dd Use a new-style class for Callbacks
For consistency with the rest of our Python code.

(imported from commit 02659914f50b488039fe8c65bd1de796e2a16e65)
2012-11-08 10:47:09 -05:00
Tim Abbott 218588ead0 models: Comment the IntegrityError code in get_client (#326).
(imported from commit 85c3580084dcd4c28f319a19d684e5a5af7069c7)
2012-11-07 18:22:32 -05:00
Tim Abbott 573cc4db33 models: Add unique_together restrictions for various tables.
(imported from commit 30957d465d5e7bc728e854b8b99f6ad99b98dba6)
2012-11-07 17:31:16 -05:00
Tim Abbott f342217700 Add timestamps to our various non-message logged events.
(imported from commit 65102419ac0032ccedcbdb342dbea9b91bbe3e13)
2012-11-06 14:12:19 -05:00
Tim Abbott 1adc54185f Fix unnecessary usage of realm ids creating new users.
(imported from commit 5870b583efffa4a5280c81125eefecc23978cf11)
2012-11-02 20:55:31 -04:00
Keegan McAllister 02aa92a604 Correct comment on filter_by_subscriptions
This isn't dead code; it's used by tests.

(imported from commit ce6cfc049d2cb8050aff1fef1b77a3778b7ceacb)
2012-11-02 14:57:38 -04:00
Tim Abbott 426ab9559d Fix creating new users via zephyr mirroring.
(imported from commit 05e01efabdce081fc574486916c7db343f2cdb1d)
2012-10-31 14:06:35 -04:00
Waseem Daher e7e05d8617 Fix up some overzealous "instance->subject" renames.
(imported from commit f4ddcfd3749d374cc6abee3b1e7a5aacc3b83e16)
2012-10-30 16:48:00 -04:00
Tim Abbott 44b332693e Fix the fact that new auto-created MIT users are active.
(imported from commit 577f1a0165a56fc3cc1ed6f0a54f6c5f31345cc7)
2012-10-29 17:30:06 -04:00
Luke Faraone 5dad59e864 Implement MIT signups.
Here we introduce a new manage.py command, activate_mit, which takes a
number of usernames and sends out emails to the users with instructions on
how to activate their accounts.

(imported from commit f14401b55f915698e83ff27b86434f53e64685f3)
2012-10-29 16:59:37 -04:00
Tim Abbott 6c39bf5cbd Cut out duplicated code between clear_database and populate_db.
(imported from commit 4bb44c20d2f0477d8a3db72788f82b0cf8572b2d)
2012-10-29 14:54:18 -04:00
Zev Benjamin ec9e0a4b9f Have get_updates include an "update_types" array in its response
This is similar to the previous "reason_empty" variable, but captures
why we've returned from the call even when there are updates and all
the reasons if there are multiple.  For now, it's useful for debugging.

(imported from commit fd8d9e859660e51b57178d066b184f831b71a0b6)
2012-10-25 18:12:11 -04:00
Tim Abbott 7c8bde5d90 Add log/restore for fullnames and passwords.
(imported from commit 048ca3c86b9f077fcbccd5df4a509191a545da4c)
2012-10-25 15:52:26 -04:00
Tim Abbott 8c4a834206 Add function for activating MIT users.
(imported from commit 0de45fc341249332909d5a0ecef4d49918658a1a)
2012-10-25 14:46:58 -04:00
Keegan McAllister b30b5f396e to_dict: Include the content type with each message
(imported from commit 413ce08029832c6bed2a43f27a1caf809fb962b6)
2012-10-24 15:43:43 -04:00
Keegan McAllister 7da2ddea8e Reorganize to[_log]_dict
(imported from commit 2f811cf6a42e5b5661679158c0053dd4ebb40dbd)
2012-10-24 15:07:14 -04:00
Tim Abbott f1e4a27106 Optimize populate_db's common code for setting up real users.
(imported from commit 074b30ac88101f8e00ddcb60b5b05defc0a11998)
2012-10-23 17:52:10 -04:00
Tim Abbott 1b67b6b711 Don't deliver messages to "fake" Zephyr users created by populate_db.
(imported from commit c88760a88382ffc07cf5f79f3093a2bfec429d53)
2012-10-23 17:52:10 -04:00
Zev Benjamin 8a39292b5d Fix bouncy pointer from pointer updates
The previous code path was buggy.  We now do separate pointer update
checking for the cases where get_updates returns immediately vs. when
it returns from a callback.

(imported from commit f236a80cd0b94bc097dbd17f113d7a9d27368025)
2012-10-23 16:39:04 -04:00
Zev Benjamin c8dd5229ed Rename updater_session to pointer_updater
(imported from commit 7646b8e636393d64ef07d0251f8c83beecf114aa)
2012-10-23 16:39:04 -04:00
Tim Abbott 386b48e80f Don't log tabbott/extra test messages.
(imported from commit 8e1adecca14e5440298fd93b41e1a43da37c807f)
2012-10-23 11:08:27 -04:00
Tim Abbott 846469c39c [schema]: Rename userprofile to user_profile.
(imported from commit adfb6152b7ec32557e3465d961695eb870506d5a)
2012-10-22 18:55:45 -04:00
Tim Abbott 93616039bc Use the new client data model to deduplicate mirroring.
(imported from commit 6ac38534aea11b1e7f8f332e76251f9501f9ab3e)
2012-10-22 18:31:36 -04:00
Tim Abbott 2b1902dcc7 Return a user_profile from create_user_if_needed.
(imported from commit d71a9b1f326f783e387bb70b5215c934799fb5f2)
2012-10-22 17:47:05 -04:00
Zev Benjamin f817bf6144 Pass the session that updated the pointer from Django to Tornado
This allows us to check whether the session that updated the pointer
is the same as a session that is doing a long poll to avoid sending
new pointer information when that information is coming from the same
session.

We still return from the long poll early, though, which is sub-optimal.

(imported from commit 7d4be0956f112eacefb7d198ea929957cd2b05e3)
2012-10-22 17:16:47 -04:00
Zev Benjamin 732ca19729 Synchronize the pointer across sessions
The client may now optionally send its current pointer during
get_updates and the server will return the latest pointer if it
differs and was updated more recently by a different session.

(imported from commit e43b377d7dfb52f83cefb0b1003863d5407caf80)
2012-10-22 16:44:57 -04:00
Zev Benjamin 66d7678423 Add UserProfile callback for pointer updates
(imported from commit bfa9c15d82f092a1810cfcee1a88e1e292bc4cb8)
2012-10-22 16:06:38 -04:00
Zev Benjamin 2a4c3b5bff Abstract the callbacks table in preparation for more kinds of callbacks
(imported from commit 695d5bceb4657ef25ba5983212082ee0c76b9d33)
2012-10-22 16:06:38 -04:00
Zev Benjamin 7ac0625e39 Add model field indicating which session most recently modified the pointer
(imported from commit 819ab358d9fa6f22ad8ccee56fe723ea7711ebc5)
2012-10-22 16:06:38 -04:00
Tim Abbott f26a614bb3 Fix Client handling in the test suite.
(imported from commit 56841a00052c3aa85f2eeb45133439a46f3caf82)
2012-10-22 13:23:16 -04:00
Tim Abbott 7530163fb8 Fix stream Verona's Recipient being created twice.
(imported from commit 710572ff8681530c52f861d9e5607eaf8390c657)
2012-10-20 20:06:43 -04:00
Tim Abbott 6a7cbaf4b1 Add some more defensive lower-casing when creating streams.
(imported from commit 25a62b0105ce7b6b871b7570d087970fed7c6d9b)
2012-10-20 19:52:01 -04:00
Tim Abbott edf9a8e7e5 Fix incorrect setting of initial API keys in bulk import.
(imported from commit ec492c787a5575f1f7b2fe68986999bbdd072a04)
2012-10-20 18:48:12 -04:00
Tim Abbott 7b3b4362dd [schema] Add a Client model keeping track of the sending client.
(imported from commit 31a430b1de14ce973addafd5d13ace049a8f8091)
2012-10-20 18:41:54 -04:00
Tim Abbott a8e4c818c6 Make logging of new subscriptions conditional on changes.
(imported from commit fff72906a52838bba144a960c0bc6a3487bef41b)
2012-10-20 18:26:21 -04:00
Tim Abbott 56dab6cb26 Log changes to subscriptions and replay them in populate_db.
(imported from commit d3055eb44326bdc59a6bc96d00b5b0bc6da86059)
2012-10-20 18:26:21 -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
Tim Abbott e434fa141e Use .objects.create and .objects.get_or_create.
This eliminates a bunch of unnecessary code and also fixes a bunch of
places where we were improperly not using transactions.

(imported from commit f194ae9226f9229fc56a0b1b21615534f486ea0c)
2012-10-19 17:42:14 -04:00
Tim Abbott 1d55c06ede Move mit_sync_table code into the correct process.
(imported from commit bc40f865f94d7b39db5e49eba09370c3fa53dc6f)
2012-10-17 22:35:02 -04:00
Keegan McAllister b9e9938197 create_user_if_needed: Use proper initial passwords
(imported from commit 009208ac64548dd6f8773ccc7738ab0c391d816a)
2012-10-17 21:08:59 -04:00
Keegan McAllister 4f56362e0f Change formatting of notify_new_message request
The requests library doesn't encode repeated key form data reliably.

(imported from commit 3cc9f5379c299a57f69bb5b7ff3b85f0c066269f)
2012-10-17 18:24:15 -04:00
Keegan McAllister ea916951f4 Disable notify_new_message calls in testing and populate_db
(imported from commit 07a0fea4173e2e27a90ac5f111927f0000377764)
2012-10-17 18:23:01 -04:00
Keegan McAllister a545876d56 Rename notify_waiting_clients -> notify_new_message
We might have other URLs for other notifications.

(imported from commit 4c1c5fe2f039816fef4c268f34692ca4f19d81e8)
2012-10-17 18:23:01 -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 5e70b5a291 Split off the Tornado code into a separate process
(imported from commit 95dbd0f438cdba06d6e6c6c539a2a3d49c577cfd)
2012-10-17 18:23:01 -04:00
Keegan McAllister 81f0d61c3b Factor out Gravatar hash calculation
(imported from commit 29872722fb4856773d98fc987a1e2d6eb99ad8b2)
2012-10-17 01:09:16 -04:00
Keegan McAllister bc43613a10 Some import cleanup
(imported from commit 265cebb011309b9a880035ccd587a5e51554803a)
2012-10-15 16:16:10 -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
Tim Abbott 8bc511d24e Re-initialize the markdown engine every 30 messages.
Otherwise, the performance leak associated with highlighted code can
cause get_updates to become increasingly slow.

(imported from commit 3c81f245a795e5dd2629c0e571054f2d87089cb7)
2012-10-15 15:29:49 -04:00
Tim Abbott 71146c8718 Use select_related to get the userprofiles for new message recipients.
(imported from commit afa729230f4ef6fb7f591b3f852fa0b271d64992)
2012-10-15 12:56:03 -04:00
Tim Abbott 002294d522 Save UserMessage objects within a transaction.
(imported from commit bd7f36801a754d4f9c09b5d370eee6b62a470b1a)
2012-10-15 12:54:53 -04:00
Tim Abbott ec37eaf734 Use select_related() when querying UserProfile objects.
(imported from commit 584859312e089ad98c4b43032ea29f03eb44a97f)
2012-10-15 12:29:27 -04:00
Tim Abbott a92be363d7 performance: Cache display_recipients.
(imported from commit 9ca18bd75213423cbf17c6262113822d3009c320)
2012-10-15 11:38:54 -04:00
Tim Abbott 41e935fd28 Send the sender_short_name to clients.
(imported from commit 1652f5cadbe9c90d4c6d53c97cb23305aaaaa34d)
2012-10-12 18:35:28 -04:00
Zev Benjamin c4d35280ea Make Message's display_recipient field be an object with consistent names for both personals and huddles.
(imported from commit 8b00f16b036ed3fb3f7d56e7393271ec1d458ea5)
2012-10-12 11:34:42 -04:00
Keegan McAllister d19d3d2bd7 Hack around Markdown parser failures for now
(imported from commit dba079d444d40e36c91508b86b243bdc805c6222)
2012-10-11 21:45:22 -04:00
Keegan McAllister 3ca3be297e Disable Markdown heading markers by padding with spaces
Because # will display literally now.

This still fails in some cases, such as

    > # foo

(imported from commit 40654a4f1dac940ba131f2a104440b6ecb7eafd1)
2012-10-11 16:23:18 -04:00
Keegan McAllister 2c3d7d6116 HTML-escape messages on output
(imported from commit f199fddf887ffbd22ebac76448accb4c48b64a24)
2012-10-11 15:01:54 -04:00
Tim Abbott eb63177a56 Fix timestamps in logging
(imported from commit c23570fa00ea682681a0065ffddd86670e5c59af)
2012-10-10 21:34:57 -04:00
Tim Abbott a5a8a07370 Increase the maximum instance length to 60.
(imported from commit e1d79e059324be03ecb84d1bdd93f83bcc4a1a8d)
2012-10-10 18:19:38 -04:00
Tim Abbott ac3f4393ff Rename instance to subject.
(imported from commit 6b4693da03f106448c137cf81cf9801cac44f2b8)
2012-10-10 18:01:39 -04:00
Tim Abbott cdcaaa578f Rename class => stream in models.py.
(imported from commit c9513da997e126bc3c84c6d66176d3402a57db66)
2012-10-10 17:47:13 -04:00
Tim Abbott 44e9e4cebf Rename Recipient.CLASS to Recipient.STREAM.
(imported from commit a530194163f7260c73921137fa1ff671f14516f6)
2012-10-10 17:47:13 -04:00
Tim Abbott 1fc4780a81 Rename create_class_if_needed to create_stream_if_needed.
(imported from commit 1bbc792332981723d3d29b24ad03811d62ced5f1)
2012-10-10 17:47:13 -04:00
Tim Abbott 8daff2e05e Rename ZephyrClass to Stream.
(imported from commit ae51b7a9e03f322dfe2dfccd250cbfc23adfe32e)
2012-10-10 17:47:12 -04:00
Tim Abbott 38c76266bf Escape pound sign before running markdown parser.
(imported from commit 418f4f76c579b5db9ec7f30cfc92c3f815323756)
2012-10-05 14:59:23 -04:00
Keegan McAllister b8fb58968e Implement conservative linkification on the server side
(imported from commit 970bcb4adf980d386442602fbb6297919fcee4d9)
2012-10-04 16:52:10 -04:00
Tim Abbott 89c73ca25f Replace 'zephyr' => 'message' in code internal to models.py.
(imported from commit 16449713202a915d12d3de2e4b4b6ac56e6d6237)
2012-10-04 14:38:07 -04:00
Tim Abbott fbf321c783 Revert "Add hopefully temporary hack to deal with bad zephyrs in DB."
This reverts commit 85fc39c39c7602990f4d8be15aa96349c544d16f.

(imported from commit b0c111a9288a92c739d5d439b6dfeaa8a4e78dd8)
2012-10-03 22:40:50 -04:00
Tim Abbott 6789356b4b Add hopefully temporary hack to deal with bad zephyrs in DB.
(imported from commit 85fc39c39c7602990f4d8be15aa96349c544d16f)
2012-10-03 18:23:45 -04:00
Tim Abbott e59d7cae48 Rename the Zephyr log to the Message log.
(imported from commit 7dedfb76b6b78ea90a2bfd20788e251c9c29ef47)
2012-10-03 18:14:15 -04:00
Tim Abbott 1ab81cff92 [schema] Rename Zephyr => Message in the schema.
(imported from commit 4f402f150c45d2097d6b16943935e6e370b4f8d8)
2012-10-03 18:14:15 -04:00
Tim Abbott 6bce5f95b0 Fix the no-apply-markdown case.
(imported from commit aeaa2cec9858ff028a58e7c0c8bf06f5d3200c8e)
2012-10-03 18:14:15 -04:00
Tim Abbott abd97578c0 Fix zephyr mirror unicode issues, hopefully once and for all.
This code successfully sends every message in our corpus of past
zephyrs.

(imported from commit 14d42ca9288e2a218eaad880691d6bd213a045ce)
2012-10-03 17:55:14 -04:00
Tim Abbott 6b7a996389 Rename log_zephyr to log_message.
(imported from commit 81baa2619148790ca6d814bf83e14651f45f512e)
2012-10-03 12:27:34 -04:00
Tim Abbott cca5f7b76a Rename do_send_zephyr to do_send_message.
(imported from commit df4dc741bf00a197ca5ab39373bc9a3eda379684)
2012-10-03 12:27:34 -04:00
Jessica McKellar 555acb1e62 models: remove unused imports.
(imported from commit 97855ff47a6a1d58e0d0f5bad4613504437150c3)
2012-10-02 17:17:26 -04:00
Tim Abbott 18a3888373 [schema] Add an API for sending/receiving messages.
(imported from commit 209d525dc5892fc4c392a8ced1588c838cbb17c4)
2012-10-02 15:49:25 -04:00
Jessica McKellar 588db5b4c5 Make class names case-insensitive.
(imported from commit e76e50156ca8dab1f7b3124351997e75ef08e521)
2012-10-02 15:16:26 -04:00
Luke Faraone f2b7d08191 Treat newlines in humbug messages as line breaks, a la StackOverflow/Github
(imported from commit d200d24fec80be5702760dda229295125142e9b2)
2012-10-02 14:31:18 -04:00
Luke Faraone 50dfbf7a1b Implement confirmation for new user signups.
We add a few templates for django-confirmation. We define a
"PreregistrationForm" which is validated by accounts_home, which then
generates a confirmation object and emails the user. This required creating
a new table for a PreregistrationUser with an email and status (confirmed)
field.

The register function now no longer accepts a "email" field in the form
and deals only with confirmation IDs to determine the email used to sign
up a user.

(imported from commit 4fcde04530aa7ad4de84579668daee7290b424ac)
2012-10-01 10:45:58 -04:00
Keegan McAllister a8ec5c533f Move the code for new messages immediately available into views.py
(imported from commit 4cfa0ead850b1a37a21ec7945b477e12681c5830)
2012-09-28 18:37:12 -04:00
Tim Abbott d6c6e67991 Fix mit_sync_table to run after we save zephyrs.
(imported from commit 7522a0f9eb5a4ab99434284c65382b5460abe4d7)
2012-09-28 15:57:51 -04:00
Tim Abbott ccee128d61 New prototype zephyr mirroring system with bidirectional support.
(imported from commit cfb95ae8d0a241e7c068106e561dc18e16461596)
2012-09-27 17:33:21 -04:00
Tim Abbott f7b8d371cd Make the last_received parameter optional.
(imported from commit 001806356286cac85f79f521a48c09686d6f6bb6)
2012-09-27 16:42:15 -04:00
Tim Abbott 699e05383f Log messages and restore them with populate_db.
(imported from commit 959f038a736e48d32819bc04bd054632a2e911c6)
2012-09-27 15:01:30 -04:00
Tim Abbott 8ffd91a6ee Move new user/class creation into their own functions.
(imported from commit 192533c4e2bc55a26e7ea70a32e7d1f64d2ed8c3)
2012-09-27 15:01:30 -04:00
Keegan McAllister d38d575c41 Markdown: disable "safe mode"
We're already escaping HTML input.

(imported from commit 02b5f1033d102a5cb3df89577ec0445202ce7071)
2012-09-27 12:31:09 -04:00
Keegan McAllister 21d55c152f get_updates_longpoll: Send at most 400 messages at a time
Give the user some messages right away; keep their browser looking active and
responsive.

(imported from commit 435dda62aa47a16114431ae7b19aa92e005d699d)
2012-09-26 17:53:06 -04:00
Tim Abbott 9180f6d381 Remove unicode debugging prints.
(imported from commit 111a7e4c78537d4986c8b43c319d3c560f3cecb6)
2012-09-26 17:30:35 -04:00
Keegan McAllister 911f4306db Optimize get_updates_longpoll in the same manner as 805a944
(imported from commit 819826d34ef6a0adbf619d4bf5e740c1838c896c)
2012-09-26 17:23:18 -04:00
Tim Abbott 5e318bc961 More unicode debugging.
(imported from commit 9ec3ca2a6c3812055ace4b7c2a3348bb586e8696)
2012-09-26 17:08:13 -04:00
Tim Abbott 4458c8f3d7 Fix unicode issues.
(imported from commit 542dc67a3d2e2d44ef212354b38e4f8212ddef64)
2012-09-26 16:46:32 -04:00
Waseem Daher 8ef40a9654 Experiment: Restore gravatars (this time with real addr).
(imported from commit 0e1cc56286264c939864ac8b398f206e27d56841)
2012-09-26 16:34:24 -04:00
Tim Abbott df01b016cb Display short_names rather than email addresses for huddles.
(imported from commit 6509305f1b0ee90cfe5c93c74e03350a557a0cc5)
2012-09-26 15:32:35 -04:00
Tim Abbott c8220ee057 Don't store the post-markdown HTML in our database content column.
(imported from commit bb81e84acc04ea0930be1026149618fbb60174fd)
2012-09-26 14:51:14 -04:00
Tim Abbott 293c8dcff8 Fix recent display recipient change.
(imported from commit d0f7e7313437a510150f941b0464c972b34a8847)
2012-09-26 13:30:06 -04:00
Tim Abbott d374312509 Use email address for huddle display recipients.
This fixes replying to huddle messages.

(imported from commit 8e6f9ce7d690c926b19c50016ec972d767428994)
2012-09-26 13:24:08 -04:00
Tim Abbott f929593263 Don't try to use in-memory storage on model objects.
It doesn't work.

(imported from commit d5f95c345061e63b12fa12f2a0219f8e3b2e0380)
2012-09-26 10:44:47 -04:00
Tim Abbott 11e5e8785d Preparation for syncing messages back to MIT.
(imported from commit 551b697366702de93579de259a9bc644be8d66ec)
2012-09-24 14:31:40 -04:00
Tim Abbott 919ddfdc31 Send recipient_id values to client and track them there.
(imported from commit 77446f7a226d8a26a287e069d08f28e4beb0b2e3)
2012-09-21 16:57:04 -04:00
Keegan McAllister 85abb3f274 forge_zephyr: Convert email to lowercase
This fixes failing User.object.get(email=...)

(imported from commit e0d5097520c6a149031e6881ae25f4c5bb967918)
2012-09-21 14:11:34 -04:00
Keegan McAllister a68a3e7ab7 Get the just-created user from create_user
(imported from commit d709c99cc670aa1b0864c40b8c0d5e52b6c90340)
2012-09-21 14:01:43 -04:00
Keegan McAllister 08345098db Use truncated Base32 SHA256 instead of hex MD5 for usernames
There isn't a specific problem with using MD5 here, but there's just no reason
to use a hash function with serious known flaws.

We have to truncate to 30 characters for Django's username field.  Using Base32
instead of hex gives us twice as many bits.  This reduces the chances of a
collision (which are pretty low already) and also provides resistance against a
targetted attack based on some weakness in SHA256.  (There are better ways to
reduce a hash to fewer bits but let's not get too fancy.)

We still need to use MD5 for Gravatar because that's their protocol.

(imported from commit ffe6955312f580676409d4f9c4ed2d7f3d0df62c)
2012-09-21 13:44:13 -04:00
Keegan McAllister 3cbc56a866 Rename MD5_SALT to HASH_SALT
(imported from commit 3112cd805614c3057a9eb8f1b251381f48ab3173)
2012-09-21 13:44:09 -04:00
Tim Abbott 2d6683f896 Deduplicate user creation code.
(imported from commit bda76a9a44bd5ed7f0726b527fdb93cec109cbed)
2012-09-21 10:45:00 -04:00
Tim Abbott 135c82717d Authenticate by email.
Approach from http://www.micahcarrick.com/django-email-authentication.html.

(imported from commit 796b8e08d8e1f9769cd3cf8ee61d3724ac3847b7)
2012-09-21 10:34:48 -04:00
Tim Abbott ee8f28a084 Use email addresses as unique identifiers rather than usernames.
Note that this code still assumes one's email address (stripped of
domain) is unique.

(imported from commit e98f96601ad109811978fc00b1165e97d8f7b185)
2012-09-21 09:43:22 -04:00
Luke Faraone eb1740e1e7 Use emails in the gravatar seed, don't display a static gravatar for the current user.
(imported from commit 64d1fd4f1cd33796bc907fef9778e088d80b8c5a)
2012-09-19 13:39:34 -04:00
Keegan McAllister db7a8277ff Replace create_{user_profile,zephyr_class} with {UserProfile,ZephyrClass}.create
Looks nicer and cuts down on imports.

(imported from commit 4fdbbb45cf6d8ad016481c663cf52fd555b41d91)
2012-09-19 13:01:58 -04:00
Keegan McAllister 5486e148e3 Cache Zephyr.to_dict
(imported from commit 7968244a813111e328fc91c34d64af727a98bb36)
2012-09-19 13:01:58 -04:00
Tim Abbott d0b36d506b models: Add database index hints.
(imported from commit 96b94b943aa8cd04c26295af797b8ed9c40f5859)
2012-09-17 11:37:14 -04:00
Tim Abbott 0b699be7eb Add some caching of userprofile objects.
(imported from commit dd8e1bec2d677e873d90806aa71519c3a37221c8)
2012-09-17 11:37:11 -04:00
Tim Abbott a3aa83801a [schema] Use a TextField for the content data.
(imported from commit 83765da990ad94233978d24bea90cce8cc66f17b)
2012-09-14 13:32:25 -04:00
Keegan McAllister ae5137b5c9 Show timestamps on zephyrs
We use the browser's local timezone.

(imported from commit 6ed6444df6edf2093b9399adb1511dd3ee80def3)
2012-09-12 17:00:02 -04:00
Jessica McKellar f52ec24926 For now, compose zephyrs to usernames.
We'll eventually need to normalize emails, autocompleted names,
etc. to one entity we use when talking to the server about senders and
personals recipients, but for now since we've hardcoded usernames
everywhere, just use those.

(imported from commit 4a0e033b301b8dec55d97157eb4993982f6b2641)
2012-09-11 16:35:01 -04:00
Jessica McKellar bfdf2bef57 [schema] Collect and display names and e-mail addresses.
(imported from commit aa6bceb05fcd5b456c03288cbfed65b14050fe88)
2012-09-11 16:34:53 -04:00
Luke Faraone 4503aaae89 Implement gravatars.
(imported from commit 1e07d295ee7c12a95091e0785a9a9c3c4e856ede)
2012-09-10 18:18:09 -04:00
Tim Abbott 37b1c1db11 Stop using foo.pk when we mean foo.id.
(imported from commit b86359254415f65b32eeefdfbcb38d7bb862c1ac)
2012-09-10 13:43:17 -04:00
Tim Abbott ca132789bb [schema] Store Recipient types more efficiently.
(imported from commit e0625ce9d2382682a5c8d53a5ac31a0399075df8)
2012-09-10 10:03:50 -04:00
Tim Abbott b6203e7240 Comment on how filter_by_subscriptions is dead.
(imported from commit c13b2ed003d78408b7c4f51ef5080658c2b4bcc7)
2012-09-07 13:54:42 -04:00
Tim Abbott f39c203d2c Cleanup style of filter_by_subscriptions.
(imported from commit 4bc62dcc97eeb98147dd73163c75a142eaf5d3c9)
2012-09-07 13:53:24 -04:00
Tim Abbott 7f6d085ab6 Improve add_callback performance.
(imported from commit 4cea356ee6b0777bddfc996d7b8ee1b5fee391c6)
2012-09-07 13:51:54 -04:00
Tim Abbott d8ade6de5b Add create_zephyr_class helper.
(imported from commit 993fbb799b706e402ae212330e4abbe28bf84ee9)
2012-09-07 13:28:56 -04:00
Tim Abbott 6c330b2654 [schema] Store zephyr receipts in new UserMessage table.
(imported from commit d909adf7528aba9a489280ebc3572791539cdd44)
2012-09-07 11:27:41 -04:00
Tim Abbott ef25dffb92 [schema] Add the realm to the ZepyhrClass objects.
(imported from commit 8189ef27f2feef0c92f9c06a9243c085e36a66f5)
2012-09-06 11:02:34 -04:00
Tim Abbott b761bf030b [schema] Fix names of fields in Subscription.
(imported from commit 5f5c643286d348d16caac03419ba3011a8b81eff)
2012-09-06 11:02:34 -04:00
Tim Abbott 38b30e5997 [schema] Add realms to the schema.
Note that realms aren't actually used for anything, aren't prompted
for, etc, so this is mostly just a schema change and the refactoring
needed to allow setting the realm in the future.

(imported from commit b8b483dcc9601b288702284879e9c99707a50a5c)
2012-09-06 11:02:34 -04:00
Keegan McAllister 04b1c21333 Remove some unnecessary intermediate lists
Use generator comprehensions for efficiency and cleaner code.

(imported from commit 6b4b709515b5c904ef38b8ea33a9d4a4af0f5468)
2012-09-05 11:41:53 -04:00
Tim Abbott 3e51ef8c1c Fix get_huddle handling of id_list.
(imported from commit 0fe1ee15b2fc6b3bef98ac47f1094b89e776c751)
2012-09-05 11:38:09 -04:00
Tim Abbott 1f151214c0 Move the huddle recipient uniquification into get_huddle.
(imported from commit 09378b583becce6467d65d6caec71a543e27be2e)
2012-09-05 11:30:40 -04:00
Tim Abbott 7105ea9290 Improve the huddle hashing keys.
(imported from commit e8e1f1ac3022f3cecfdd22d1d4f319cc4f1ce886)
2012-09-05 11:19:31 -04:00
Luke Faraone be3a69611a Restrict new_zephyrs in add_callback to current user's subs.
(imported from commit 7aab1b081cf9b8602512402547fe3592cf710d82)
2012-09-05 10:43:36 -04:00
Tim Abbott 4d284d8a92 [schema] Add support for multi-user personals ("huddles").
This is controlled by listing multiple comma-separate usernames in the
personal message sending box.

(imported from commit 06c9dadb7977b98f88ad31e5df453b59f1afad96)
2012-09-04 19:15:07 -04:00
Tim Abbott 8f058937a0 Rename recipient.user_or_class to type.id.
(imported from commit 74639cd08d0f53ae39624fc793f6fe55325b6d45)
2012-09-04 16:34:39 -04:00
Jessica McKellar 15516b52dc Auto-sub to personals on account creation.
(imported from commit 5b8b5b0c670bdd4c9663837a15dd80bcbc6ddcb1)
2012-08-31 10:58:09 -04:00
Jessica McKellar 390f6c83c7 Fix displaying personal zephyrs you send.
(imported from commit 2357cd273933268556bbdebe540f29a45c66a245)
2012-08-31 10:11:23 -04:00
Jessica McKellar 03401bd8d7 Remove stray print statements :-(
(imported from commit 77d332e9903d99e760557656cee439d313738d0d)
2012-08-30 17:40:30 -04:00
Jessica McKellar 5355b4ea1f Add missing active check on subscriptions for new zephyrs.
(imported from commit 58d2a30d221b0849d6e8ed063d75f8781e38f536)
2012-08-30 17:34:44 -04:00
Jessica McKellar 7e56e7a0f4 Add a navigation link for managing subscriptions (for starters, just unsubbing).
(imported from commit 23274a8790bf1f017e9c33db52bf746e291f23ba)
2012-08-30 17:17:47 -04:00
Jessica McKellar 111dde0075 Add an active bit on subscriptions.
(imported from commit abf7ea7dc51e830c503204a319b6cbda09e032e8)
2012-08-30 16:48:40 -04:00
Keegan McAllister d57d19e562 Move all zephyr HTML generation to the client
(imported from commit 3afec768a5cd220c14ce615e03c29ee22754fdf2)
2012-08-30 16:41:09 -04:00
Tim Abbott 9afd63692f Implement long polling using Tornado.
(imported from commit 4385304b27d7fe55a57a23133cd214fe8fc33482)
2012-08-30 14:29:34 -04:00
Jessica McKellar 1394a685e2 Only display zephyrs from your subscriptions.
That means your personals, classes to which you are subscribed, and
personals you sent to other people.

(imported from commit 15fbea92b538ff345f9978438c1c5e66766d0a67)
2012-08-29 12:57:26 -04:00
Jessica McKellar 018c62829a Give our models meaningful reprs.
>>> from zephyr.models import UserProfile, Recipient, Zephyr, ZephyrClass
>>> for klass in [UserProfile, Recipient, Zephyr, ZephyrClass]:
...     print klass.objects.all()[:2]
...
[<UserProfile: othello>, <UserProfile: iago>]
[<Recipient: Verona (1, class)>, <Recipient: Denmark (2, class)>]
[<Zephyr: Scotland / Scotland3 / <UserProfile: prospero>>, <Zephyr: Venice / Venice3 / <UserProfile: iago>>]
[<ZephyrClass: Verona>, <ZephyrClass: Denmark>]

(imported from commit 9998ffe40800213a5425990d6e85f5c5a43a5355)
2012-08-29 10:45:20 -04:00
Tim Abbott 23af7f09ec Remove unnecessary create_user_profile argument.
Signed-off-by: Tim Abbott <tabbott@humbughq.com>

(imported from commit 0b12743f8b1b9c2bcfe8444b3e025d31b704bb12)
2012-08-28 17:40:09 -04:00
Jessica McKellar 2b9a3205be Switch zephyrs to the notion of a "Recipient", which is either a class or user.
(imported from commit edc46267dab9cc972358b6020ca28b009e15d8c5)
2012-08-28 16:34:23 -04:00
Jessica McKellar d90e8f6ec5 Initial Django commit: basic account, zephyr stream, narrowing, etc.
(imported from commit 3cd40521171a4020c19021eda0d20ee9f802af41)
2012-08-28 12:44:51 -04:00