Commit Graph

185 Commits

Author SHA1 Message Date
Tim Abbott f843152427 log_event: Clean up duplicated timestamp setting code.
(imported from commit dc3b3144ca23106bef2d953b00dc042115008703)
2012-12-05 15:34:19 -05:00
Tim Abbott 156f6ee576 Log an event on new realm creation.
(imported from commit 98872c7e5922fecd2bed9b544ff5fffd8147343c)
2012-12-05 15:34:18 -05:00
Tim Abbott 81d560dc1f populate_db: Preserve the user's date_joined on replay.
(imported from commit 91dcb4f41e0e58f165db6a7417e57548914ddab7)
2012-12-05 15:34:18 -05:00
Tim Abbott 8e3bcdaa19 Add user_created event type and appropriate replay code.
This is necessary for correctly replaying new user signups on non-MIT
domains.

(imported from commit e5a9d37b8772bd9794579ef16e7039196ac06f62)
2012-12-05 15:34:18 -05:00
Zev Benjamin 7e4776322d [manual] Unify huddles and personals into private messages on the receive path
feedback-bot and zephyr_mirror will need to be updated and restarted
when this is deployed to prod.

(imported from commit fe2b524424c174bcb1b717a851a5d3815fda3f69)
2012-12-04 18:01:51 -05:00
Zev Benjamin f4898ea490 do_send_message: use JSON for the user list instead of joining/splitting with commas
(imported from commit 85d94ca647d0e6707f4f96e2b7a7b330f76db9d9)
2012-12-04 12:44:44 -05:00
Zev Benjamin 2907c3ca01 Create the Message and associated UserMessages in the same transaction
(imported from commit 96daa925142c97e34e68fae8e4bef713731b4173)
2012-12-04 12:44:44 -05:00
Tim Abbott cf31374497 bulk_create_streams: Fix missing select_related().
bulk_create_streams was taking about 10 seconds to run with prod data;
this should be a basically immediate operation.  The cause was a
missing select_related on one of the loops through all streams.

(imported from commit 8b82f0c41facc3999bb699dbc350708ac69797e9)
2012-12-04 10:55:31 -05:00
Jessica McKellar 55e68fc89a Log subscription color changes so they can be replayed by populate_db.
(imported from commit 5c7f46ed0d727926e9819cb2d71eb31f241e2e34)
2012-12-03 12:46:27 -05:00
Jessica McKellar 71371823f8 [schema] Add a StreamColor table.
(imported from commit 2906c30ad326373bc6265bf30dd0a70e11d69c7d)
2012-12-03 12:46:26 -05:00
Keegan McAllister 36816c46e2 Add a function to remove all Messages that are not referred to by any UserMessage
(imported from commit cdad013aed0fd8d1bc6ec8c2dcf5905390a01339)
2012-11-30 17:24:37 -05:00
Zev Benjamin f568ff20c2 Remove format_delayed_updates_response
(imported from commit d1aa1a1f36fc5ec36f1658aec489db84ae469f7c)
2012-11-28 16:36:43 -05:00
Jessica McKellar 4832a6a1fe [schema] Add a management script to create default streams for a domain.
Run this script on an existing realm to create or change default
streams, which new users will get upon account creation.

(imported from commit 8938dcbd3520d97d25b4c6ca783d35c9aef52df0)
2012-11-28 14:07:16 -05:00
Jessica McKellar cca39ca5e8 Add default subscriptions upon non-MIT user creation.
We'll probably eventually get fancier with this, suggesting various
default sets depending on the company or making it easy for one person
to create default subs for several people at once.

Until we know what we want, keep it simple.

(imported from commit 14319dd50c67fe33ac6f15288dba4916ce0a89ac)
2012-11-26 21:02:29 -05:00
Jeff Arnold a6ec875268 [schema] Add enable_desktop_notifications to user profile
(imported from commit f5b543e8446263ce8855561441a6d4c1a8d41f4d)
2012-11-26 14:43:55 -05:00
Jessica McKellar bdf3473bac Fix bug where sending a PM would display as sent to the wrong person.
In get_display_recipient, the userprofile was selected incorrectly by
user_id instead of the userprofile_id. In production, this hasn't
resulted in a user-visible error because we use MySQL and user ids are
always equal to userprofile ids.

This does happen if you are using SQLite locally and run populate_db,
which adds a bunch of users in parallel in an insufficiently
transactional way.

(imported from commit c25a04b4919e3efdfc6996b03492f7714d9034e8)
2012-11-20 15:08:50 -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
Keegan McAllister af36b437b6 log_event: Use 'with' for files
(imported from commit d49b46ecd8aa74679ade3820004d10cb42940ad3)
2012-11-16 13:43:44 -05:00
Keegan McAllister ccf14b89c2 log_event: Don't flush the log file right before we close it
There's no need.

(imported from commit 8c3b933b7fddfb858ee4dc201b63b6fe921dc8e9)
2012-11-16 13:43:44 -05:00
Keegan McAllister f132cd311b log_event: Close the lock file after we're done with it
(imported from commit 023e50e1aeeafee334f9b55e12ab91aa84a7872a)
2012-11-16 13:43:44 -05:00
Tim Abbott 7227cb32f8 zephyr_mirror: Compute zephyr mirror fullnames server-side.
(imported from commit 9e6f6f9fe49d60ed30753582480e592613feb3c8)
2012-11-14 15:03:46 -05:00
Tim Abbott 0971b3d8e6 Add proper transaction handling in create_user_if_needed.
(imported from commit cab9cb4886acf61f36a0b0bc80d87ed9037cc414)
2012-11-14 14:33:31 -05:00
Keegan McAllister 42a5ea9d2e Specify requests.post data as a dict
These were lists of pairs because we were going to repeat keys, but that didn't
work anyway.

(imported from commit 687b3f7b8a2821d057719c725f1f39db3992ae5c)
2012-11-13 17:33:41 -05:00
Keegan McAllister f82e8fc4d1 Move Markdown rendering out of the Tornado server
(imported from commit fc726939aa1061c40b292899dbbc9ade3b29ea01)
2012-11-13 17:33:41 -05:00
Keegan McAllister c0204ea5b3 get_display_recipient: Sort huddle recipients by email address
We need a deterministic order for the client test suite, and it seems like a
good idea generally.

(imported from commit cc8fc555611f2d2f1b21e63ce6860d446baa3410)
2012-11-13 15:09:15 -05:00
Keegan McAllister a954277647 get_{display,log}_recipient: Use a join query
(imported from commit 1278f46655760842e21a62ca5add891515ee1945)
2012-11-13 15:09:15 -05:00
Keegan McAllister 31496e9189 Generalize Tornado-related settings
(imported from commit 76a1338a87e1a6663aa7602a499e2d769814bf08)
2012-11-13 10:59:02 -05:00
Tim Abbott 9e9438153c [schema] Store analytics on usage of our product.
(imported from commit 4fbf8215225fc8f505b9c749ccf80c556af13e87)
2012-11-08 18:00:57 -05:00
Tim Abbott 9a14073dda models: Add unique_together constraint on UserMessage table.
(imported from commit 79fcc1c9db11cc89a300b9d78a3c2f8cccb0917c)
2012-11-08 15:10:34 -05:00
Keegan McAllister d52728e3ae Recipient: use a dict to name types
(imported from commit 35ab065e7def38cb684672e48f2ca10f5f6479ad)
2012-11-08 10:48:34 -05:00
Keegan McAllister b57270322a models: Always pass a tuple to string %
(imported from commit c2881ef8f60fd7be2f70138868214d42d41b492d)
2012-11-08 10:48:13 -05:00
Keegan McAllister 979d997cf8 bulk_create_huddles: Use a set for existing_huddles
(imported from commit af66c6e4e87109feafbafdc6e84cf02903ca93ca)
2012-11-08 10:48:13 -05:00
Keegan McAllister 246c0a37bc Get rid of bare 'raise' outside 'except'
Within 'except', 'raise' re-raises the current exception.  But outside, it produces

    TypeError: exceptions must be old-style classes or derived from BaseException, not NoneType

which is pretty confusing as a generic "something has gone wrong" exception.

(imported from commit 9fcd003a952b82df67726c26161dced079978a32)
2012-11-08 10:48:11 -05:00
Keegan McAllister 5933a902c7 Remove unnecessary line-continuation backslash
(imported from commit afabcea50432b0e00f17e7a4cc4cb6c4a0c19cf2)
2012-11-08 10:47:09 -05:00
Keegan McAllister a70d82b8fc Use comprehensions more consistently in bulk create
(imported from commit f6b67b9ce74b379004e5fde6c99368c077a77f7b)
2012-11-08 10:47:09 -05:00
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