Commit Graph

2196 Commits

Author SHA1 Message Date
Zev Benjamin 616bd3a1e1 subs.js: Factor out code for formatting and adding users to member lists
(imported from commit 5f929df5c0a105a3774e9e43255d17093ea1496f)
2013-01-24 17:59:03 -05:00
Zev Benjamin 4dbd51033a Hide subscription settings on unsubscribe
(imported from commit 28f08ffdf5ffc4af697563df19b4facb28e9c681)
2013-01-24 17:59:03 -05:00
Zev Benjamin e03fe9e3f1 Expand subscription settings of newly created streams
(imported from commit 6171014fd712b60d83b2a0ac2953d8065c00a585)
2013-01-24 17:59:03 -05:00
Zev Benjamin 2e7d411ef8 Remove redundant success messages from subscriptions page
The fact that the user sees a change (the button changes or a row
appears) makes it obvious that the operation was a success.  The
success messages were only serving to make the page scroll
confusingly when you couldn't see the top.

(imported from commit 471b9304f71bb8533c98d208b855d4d75c04a886)
2013-01-24 17:59:03 -05:00
Zev Benjamin df712b7794 Move the "create new stream" form into the subscriptions table
(imported from commit 6cfccf01b4253423e271a08c74f6077cbc10fce3)
2013-01-24 17:59:03 -05:00
Zev Benjamin 131167e228 Remove btn-block class from subscribe/unsubscribe buttons
It's not doing anything for us because we also float the buttons.

(imported from commit c63c153821ef392fbfca732d4a6e79a18ea21ff0)
2013-01-24 17:59:03 -05:00
Zev Benjamin 6082222a68 Don't try to show all streams on the subscriptions page for the MIT realm
The query fails anyway, so this is not a safety check.  This commit
makes it so that MIT users actually see their subscriptions instead
of an error.

(imported from commit ee635943728d7d9823e118d9fa51c402b1cd9bf2)
2013-01-24 17:59:03 -05:00
Zev Benjamin 3250e83e66 subs.js: rename render_subscribers() -> should_render_subscribers()
(imported from commit a7273c330ad94001cc008bcd06a60a0e11fb937c)
2013-01-24 17:59:03 -05:00
Zev Benjamin 0d9c2fd7f4 Show all public streams on the subscriptions page
(imported from commit 1f00e864a7ae653aad02328dff1b8683c5d585d9)
2013-01-24 17:59:03 -05:00
Zev Benjamin 72ebecf801 Do initial stream color fetch in subs.js instead of zephyr.js
(imported from commit e819e04951be037241b43c8c7061c7979038b7b8)
2013-01-24 17:59:03 -05:00
Zev Benjamin 6e05a72898 subs.js: Simplify subscriptions management
We now keep around the subscription information for streams that the
user unsubscribed from in stream_info and have a field that
indicates whether the user is currently subscribed.

(imported from commit 973e2f4bd4139157b03d7c1a372db93a1a5130f7)
2013-01-24 17:59:02 -05:00
Zev Benjamin 7f2252cfa8 subs.js: Factor out code to set stream color
(imported from commit 40c907976aef0d860d4963285be96430f719d0a7)
2013-01-24 17:59:02 -05:00
Zev Benjamin 8e7ac23d2b Make subs.js the keeper of the streams list
(imported from commit 566f529757bb83ad8dd4e52d3fc8c1b90c497ca2)
2013-01-24 17:59:02 -05:00
Leo Franchi 556295dd28 Add unit tests for new invite-only streams
(imported from commit 89f19b85a97d4f9a35988d7c7eb29984719523e5)
2013-01-24 17:34:22 -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
Leo Franchi 7d05450411 [schema][manual] Add schema invite_only flag for streams
(imported from commit 6234b67b3c72912bf40e39007bbc884d20774806)
2013-01-24 17:34:21 -05:00
Tim Abbott 2740f930fe Fix PublicURLTest to actually test for public URLs.
Previously it was just testing that sending a GET request to our
POST-only URLs returned a 400 error.

(imported from commit a510734271385046bbf29166b38c0ecbd104d2da)
2013-01-24 10:58:51 -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
Jessica McKellar f53e31e118 If a web client is requesting message that are too old, force a reload.
If get_updates requests a message ID that is too old, Tornado will
return a 400, and currently the only way to start caring about newer
message IDs is to reload.

(imported from commit 1638d71868475ffd793162afc7a2731cab14bd75)
2013-01-23 11:33:07 -05:00
Leo Franchi 2c64bf9c89 Add a test for api_get_public_streams
(imported from commit c2409962e61add9f33982f992350bff6051617a9)
2013-01-23 10:46:41 -05:00
Leo Franchi 0e0e5f63bd Add a test class for api_get_profile
(imported from commit e8e06cb14066b4c53b6830a015da84e92c444a62)
2013-01-23 10:46:41 -05:00
Luke O'Malley cde69d5bf8 activity: Add iPhone and Android tabs to /activity
(imported from commit 225ac7a718e5545296137c6703fe13c89d0dbbf5)
2013-01-23 10:25:48 -05:00
Waseem Daher 3b891d2f74 Use Glyphicons font for gear icon, rather than image.
(imported from commit 46e2524ab0bcf4e52bd09525b45d15198a82da03)
2013-01-22 17:23:18 -05:00
Waseem Daher 26fa891b88 Import Glyphicons font.
(imported from commit 6da2b1f0fdfbac321f25136a48fe4157d681ea6e)
2013-01-22 17:23:17 -05:00
Waseem Daher 9e73035cc4 Add Glyphicons cogwheel.
Longer-term this should be done in a more sustainable manner, i.e.
including Glyphicons like we currently include Halflings.

(imported from commit 3f405c969352481626614a0d61874bd77f0388b7)
2013-01-22 17:18:51 -05:00
Waseem Daher 1f103231e4 Unbreak scroll-position-restoring for the settings page.
(imported from commit 81dcf4d81189764710506294ee4f9400ecd5d883)
2013-01-22 17:18:51 -05:00
Waseem Daher 34bc6c8034 More reasonably scroll when you switch to the subscriptions page.
(imported from commit 549521cb3f8125b90728d62ce0e334f5a6c1a9e5)
2013-01-22 17:18:51 -05:00
Waseem Daher 01ee0ccc9c Return to home view if a search is initiated from elsewhere.
(imported from commit a7453f269cabc2dd349a9711fcb6e84de18fecd7)
2013-01-22 17:18:50 -05:00
Waseem Daher 4b1ea32a66 Don't cause gear icon to always be pressed in, and fix scroll position.
This commit both causes the settings button not to be drawn as
pressed, but also fixes the issue we were experiencing where,
e.g. changing from "Home" to "Settings" and back to "Home" would cause
you to lose your place.

(imported from commit 5084b280a202f6bf8f811834bf9d2734a034c8c1)
2013-01-22 17:18:50 -05:00
Waseem Daher 66b24c8738 Don't color searchbox when narrowed.
No longer appropriate in this redesign.

(imported from commit 8c585e8bc0e31027d51d502e1537778b00ffab27)
2013-01-22 17:18:50 -05:00
Waseem Daher 56ffad03e8 Make clicking on "Humbug" equivalent to picking "Home".
(imported from commit 5712a225faedb45e2d2d442798b1e250ffc67b41)
2013-01-22 17:18:50 -05:00
Waseem Daher 504dff9a51 Move search and navigation menu into a "settings" gear at the top.
This is really the first step of implementing the "Oppa Gmail Style!"
redesign, and is largely an HTML/CSS-based change, with some
slight JS tweaks to deal with things being renamed or being no
longer necessary.

(imported from commit e05adc283ea066f0f90009cf712c4f3657c2485a)
2013-01-22 17:18:50 -05:00
Waseem Daher f08dc13f73 Add a fixed navbar at the top of the page.
(imported from commit 1e131932503afe97ddd08e8538b2a0f43727313c)
2013-01-22 17:18:50 -05:00
Waseem Daher 35b05dda95 [third] Make a .container in a navbar mirror a normal .container behavior
Prior to this commit, at <979px, the .container in a .navbar has
`width: auto`, but a normal .container has width 724px, which causes
the two to drift out of sync.

This fixes that.

(Arguably, it's weird for us to waste ~200px scrunching
this down to 724px at this ratio, but we can solve that
as a separate issue later.)

(imported from commit 1f431ca1e2168db75821ea0be43941d29fd3e6b8)
2013-01-22 17:18:50 -05:00
Waseem Daher 059dac95aa [third] Disable responsive navbar.
We always want the navbar to stick at the top, no matter what
the screen size, and we want it to consistently look the same
height, etc. regardless of our page width.

This is possibly also accomplished via position: absolute !important
and other overrides in our own CSS, but this actually seems
slightly cleaner in a way.

(imported from commit 340fafb49bcbc1088a816897d320e252c4615d19)
2013-01-22 17:18:50 -05:00
Waseem Daher 22ce2c04e3 [third] Bootstrap bug fixup - dropdowns not closing on fix
Some time between the 2.0.4 and the 2.1.0 upgrade, Bootstrap broke in
a way such that clicking on a dropdown did not cause it to close.

Here's the bug thread about it:
https://github.com/twitter/bootstrap/issues/4497

I've implemented this workaround discussed there, though the bug is
fixed in 2.1.1, so when we upgrade this will go away (which is why I
only reluctantly tag it 'third', since the diff will not need to be
carried forward.)

(imported from commit f8d9cf65b33306a426d864c9b503bb3446614111)
2013-01-22 17:18:49 -05:00
Jeff Arnold fc0b7c00f1 Improve selecting, copying, and pasting multiple messages
Addresses Trac #289

(imported from commit 53078abc23f4939b3f5ffba084f16c340e4928c5)
2013-01-21 21:30:43 -05:00
Jeff Arnold bb19978397 Reset the new message count whenever the user mouses over the window
(imported from commit 5813398dbc59acc9f9e53c1e0631fc7d327de50d)
2013-01-21 15:54:02 -05:00
Jeff Arnold 621dbcaac0 Firefox on Ubuntu claims falsely to be able to do webkit notifications
(imported from commit d4778f38eaefc4fe95d93c6f3dcb5e43bbef5bb2)
2013-01-21 15:53:52 -05:00
Jeff Arnold 360737d928 Fix lowercasing issue with notifications for people with same name
(imported from commit 7f9c6f040c428af2c53929e4251861dea9361f2f)
2013-01-18 18:02:14 -05:00
Jeff Arnold 5b9cb1ebcd Fix notifications for users whose username is their first or last name
(imported from commit 66a58e81571f4eed3c840950bde63ef245ca4d48)
2013-01-18 17:02:17 -05:00
Waseem Daher dfadc79dc9 activity: Display the user portion of the email address rather than short_name.
Apparently short_name is not consistently the person's username
in our system -- for many MIT people, it's their full name.

(imported from commit d975300a59c7afe5ee20b4a0db1bd51110c3df33)
2013-01-18 13:47:43 -05:00
Waseem Daher 068c702883 activity: Display short name instead of full email address.
As of this writing, short_name is the part before the @-sign,
and we already display the realm, so no need to display it
twice.

(imported from commit f5f9b29bff99b36b0c23176348c2869193467c38)
2013-01-18 13:34:39 -05:00
Waseem Daher 764047e113 activity: Add names to the table.
(imported from commit d4554690a9381dd0b72c7c03116dc01145960a5b)
2013-01-18 13:29:53 -05:00
Tim Abbott 13bbf20260 Restore original 25000 message cache size.
(imported from commit 5eb0da70a8514f75addcc042d1a3e3aa98711e25)
2013-01-17 16:20:18 -05:00
Tim Abbott 03ca42a988 tornado: On user_message/stream_message cache misses, query the database.
This should fix the issues we saw where users who hadn't received a
message in the cache would not be able to receive new messages.

(imported from commit 3834dd5bd5a10c7a603194b540d78afd8a966017)
2013-01-17 16:20:18 -05:00
Tim Abbott 8cb8c0065c Move get_stream to models.py and accept an id for the realm argument.
(imported from commit 7ce09b7ed450cfa3ddf1de22bbb0b19abfc4a2a2)
2013-01-17 16:20:18 -05:00
Tim Abbott b6345e6c3d tests: Remove incorrect default 'last' value of '1'.
(imported from commit b2cfce7e7197b69d7d7c6c3253c21d0f8d341a98)
2013-01-17 16:18:53 -05:00
Reid Barton 07edc87cb9 Fix subscribe-and-send
When not in lurk mode, lurk_stream is undefined which caused
lurk_stream.toLowerCase() to fail.

(imported from commit 63ce79083b55a37cb0455871237a76d724fbbbea)
2013-01-17 15:37:36 -05:00
Reid Barton b8d56433f0 Send customer29.invalid signups to customer29.invalid too
Eventually there should be a database table or something where we can
configure this for each realm.

(imported from commit 5f3e6823f420e113da8ff8c521cc706175299fa4)
2013-01-17 14:37:52 -05:00
Zev Benjamin 747df69de1 Show a loading indicator while the subscriber list is loading
(imported from commit 83c6d64f665e82d1cff6e9654342d2a6c4bf6f36)
2013-01-17 14:19:37 -05:00
Zev Benjamin 661632673b Show a loading indicator on the subscriptions page
(imported from commit f5c4847e016921827354df09a544d98ceef16bee)
2013-01-17 14:19:37 -05:00
Zev Benjamin 4637b20f43 Set up the subscriptions page when the page is shown instead of when its about to be shown
This is needed for the next commit so that the loading indicator is
created while its associated div is visible.

(imported from commit 72d6ccc14158b49e0ea640ab818114869aa548bf)
2013-01-17 14:19:37 -05:00
Zev Benjamin 1b58e6eb9c Hide loading indicators when they're destroyed
(imported from commit e83204771b4ac7c0f0a7b19b6c306440d5cedabb)
2013-01-17 14:19:37 -05:00
Luke Faraone 63d43aa152 Notify us when a Hunt user signs up.
(imported from commit 10d4eea99427c16f8936f7fc2e2a821e7fbf73c6)
2013-01-17 13:54:52 -05:00
Tim Abbott d4ad38882d Increase the usermessage cache to 50000 messages.
(imported from commit 3b937a45339c8ab68fe07901518df1b97885afd3)
2013-01-17 13:14:02 -05:00
Reid Barton 3e928cec48 Simplify navbar at phone size in lurk mode
(imported from commit b4e7336174d4cde4947c96fa82473c311c6ed2b5)
2013-01-17 12:17:06 -05:00
Tim Abbott 0ab3b3947e Use a smaller cache for stream messages.
This is a hack to work around the fact that the query here takes far
longer than it should.

(imported from commit e6ee00c0636fe85cd946e4e3f2bbb2bda2da1f26)
2013-01-17 11:32:20 -05:00
Reid Barton 8c90808491 Reduce some horizontal padding/margins in skinny windows
(imported from commit 47e2cc9a035acdfbc2e475bf770f15f90d896ac0)
2013-01-17 11:02:32 -05:00
Reid Barton ef8c7d78ac Keep the search box from overflowing in skinny windows
A hack, but better than the status quo.

(imported from commit 3a523904ffee7b2c64e5fc118eeb8e2f7575541c)
2013-01-17 11:02:32 -05:00
Tim Abbott 9f93d9f46b tornado: Speed up Stream message cache initialization query.
The stream message cache query was grabbing an overly broad set of
columns and related models (e.g. the sender's user_profile), so that
Tornado would spend too long doing the query.

(imported from commit 6a692bc0e31957d4b9d9528d348c4b07a09eb15c)
2013-01-17 10:54:39 -05:00
Luke Faraone a3f412b193 Add functions for CUSTOMER30 registration.
(imported from commit c4b6f744ffa5b41df4170735f081bbe5655a54fe)
2013-01-17 10:49:10 -05:00
Jessica McKellar 8d1ccad29b Prominently display the user in Django 500 emails.
As a side-effect of customizing the e-mail, this also makes the host
on which the error happened a part of the subject line.

(imported from commit 7d5e9ad108b48fd34528512c5955567119935d4e)
2013-01-17 09:47:10 -05:00
Jessica McKellar e3b852b79e Filter out stream names in subscription and message requests.
(imported from commit bf1cf085361e45da21d512e77829059fe35c95c0)
2013-01-17 09:47:10 -05:00
Reid Barton 949dcbfbc7 Fix inverted logic for autofocus field in set_mode
This meant that the "New stream message" button would focus the wrong
text field.

(imported from commit 5e34f0fb936b94b8c1515e915e8059d19feba45e)
2013-01-16 16:04:17 -05:00
Zev Benjamin 93c706a610 Fix subscriptions page for MIT users
Prior to this commit, they weren't able to subscribe or unsubscribe
from streams or change stream colors.

(imported from commit 7f690c724bec3e7e6ba3b45ac7b41d1f7296b6f1)
2013-01-16 15:00:35 -05:00
Zev Benjamin e6c5b309ce Use consistent terminology for loading indicators and spinners
(imported from commit 54d14c7176e8feb125de253d1bf6205013d53760)
2013-01-16 14:45:23 -05:00
Zev Benjamin 9d27878abf Destroy spinners with a new abstraction instead of hiding them
If you create a spinner in a hidden element and then show the
element, the spinner is placed differently than if you had created
the spinner while the element was visible.  This commit makes it so
that we never create spinners while their parent is hidden.

(imported from commit a21e68976d70fcceece30ee35f5e7cf6f9490497)
2013-01-16 14:45:23 -05:00
Zev Benjamin 5e76815c43 Use not-tables for loading indicators
(imported from commit 37a18feea4366e66d4e0a42d8f66edc55928c5f7)
2013-01-16 14:45:23 -05:00
Zev Benjamin beea0f747e Rename loading_{indicator,spinner} to page_loading_{indicator,spinner}
(imported from commit e1222569f62ac693d45d2f057ef6b05c883c900e)
2013-01-16 14:45:23 -05:00
Zev Benjamin 1b1d5ff92a Use a helper function to create spinners
This allows us to use a uniform style across all our spinners.  It
also cuts down on boilerplate HTML.

(imported from commit 9879f38e0f1ca8edd40a937753811e329447262d)
2013-01-16 14:45:23 -05:00
Zev Benjamin 03adc138c5 Remove dead CSS
(imported from commit fcabfeca475be71c19e326f938e4112bd71794b9)
2013-01-16 14:45:23 -05:00
Reid Barton 2797a41fd8 Automatically subscribe on send when lurking
(imported from commit 636c07346e766615a0012e4532f35d328bb7984d)
2013-01-16 14:19:06 -05:00
Reid Barton 64ebbc6c73 Restrict lurk mode compose box stream to the lurk stream
(imported from commit f187f619fc77645a294ab4cb90baf802f55d3326)
2013-01-16 14:19:06 -05:00
Reid Barton 169fb36674 Don't move the pointer when in lurk mode
(imported from commit 6acda4b6d924d605e8ade945e1e4f10ce1e2864e)
2013-01-16 14:19:06 -05:00
Reid Barton 9e23907259 Add "Lurk" mode
/?lurk=foo will show all messages to the stream "foo", regardless of
whether you're subscribed.

(imported from commit 049d98b3ee8df19ef0a9dc392ae941dd463f8dd5)
2013-01-16 14:19:06 -05:00
Reid Barton ed29f22069 Implement single-stream get_old_messages/get_updates
(imported from commit 22a5c4985f36c38cf2490ecf26da294b502f8e46)
2013-01-16 14:19:05 -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
Reid Barton 7b7f6390f9 Add a notion of "public" stream
A public stream is one for which any user can view all messages sent
to the stream, regardless of whether the user was subscribed when
those messages were sent.

For now, to avoid a database schema change and to facilitate testing,
public streams are all streams on the customer29.invalid or
humbughq.com realms.

(imported from commit 7a71fd788d585a6f5b3e494e771ec85b632bb36e)
2013-01-16 14:19:05 -05:00
Zev Benjamin d3dd0a805a Inlucde the current user in the people list
(imported from commit a596b61a68453126726bd6f56a6c421022e1e395)
2013-01-15 17:40:30 -05:00
Zev Benjamin 14cccd9787 Be more robust when creating names for the subscriber lists
(imported from commit fca2c0f2d9dcee4830394c9be5b08ce81379e4a6)
2013-01-15 17:40:30 -05:00
Keegan McAllister a15a1702e1 search: Only highlight actual message or recipient header text
Before, a whitespace-only search would "highlight" the pointer and all kinds of
other interstitial space, which totally broke the page layout.

Fixes #408.

(imported from commit e7e0e251551a9da5a2ea53e36b9cce16e3e30634)
2013-01-15 17:28:07 -05:00
Waseem Daher 7a6068c3ad Colorize the stream bar in the composebox based on where we're writing.
(imported from commit 8e9bddf465661826d63fe0f79e3f1bd6b903cf4d)
2013-01-15 17:22:47 -05:00
Zev Benjamin 45927e19eb Rename subscribers list section to "Members"
(imported from commit a684200fa66b2e376588a0aa87fa8ee271eedf6d)
2013-01-15 17:02:39 -05:00
Zev Benjamin 0e2401199a Show full names in stream subscriber lists
(imported from commit 6be00256da74db6af9a6dd14e70929679c19db52)
2013-01-15 17:02:39 -05:00
Zev Benjamin cb8c67b325 Keep a dictionary of user email address to person object
(imported from commit 16d63fefff3bda33cfc2f90398539b5e2d9bb499)
2013-01-15 17:02:39 -05:00
Zev Benjamin 26f38065cd Insert text for the subscriber lists into the DOM as text nodes
This effectively escapes the names.

(imported from commit 68cfdaba2376a8863baf7e7325c4d8a77273de7f)
2013-01-15 17:02:39 -05:00
Zev Benjamin 28a2832415 Use get_stream in more places to avoid case-sensitivity errors
(imported from commit 9b7109d4e23db4359751b0283025b7ff60e06836)
2013-01-15 17:02:39 -05:00
Zev Benjamin 4ffc6a2de1 When subscribing to streams, send back the canonical stream name
(imported from commit 7803409878cca4627447bc64735ad71f56701a5c)
2013-01-15 17:02:39 -05:00
Zev Benjamin 17e92ebe13 Sort the subscription member lists
(imported from commit 54457c2cbe971cd8f29f0d682890c18f9ca05bd5)
2013-01-15 17:02:39 -05:00
Zev Benjamin 1d4a34aeba Clean up stream subscribe/unsubscribe button code
(imported from commit ac8fc7058534aaa3fdcb161c2aead4cc397980cf)
2013-01-15 17:02:39 -05:00
Zev Benjamin 044fc61be2 Restrict the get_public_streams query to non-MIT or superusers
(imported from commit ede1dff6176e6a39da126948ce307941e6dffaec)
2013-01-15 17:02:39 -05:00
Zev Benjamin 76b1e4778d Expose get_public_streams to the JSON API
(imported from commit 2ef9e000e4cd9fcc075e66d3da9c4bce63d68a4d)
2013-01-15 17:02:39 -05:00
Zev Benjamin 97e7cae796 Rename subs.fetch -> subs.setup_page
(imported from commit 385ff00cc5ebaafe9127974471ed2d55f0cdf546)
2013-01-15 17:02:39 -05:00
Zev Benjamin 717513cc07 Only draw a color picker when it is shown
(imported from commit 3ad2f3dbc753a1e04429ac365aa1c9d244742cbc)
2013-01-15 17:02:39 -05:00
Zev Benjamin 3442ac05b8 Be more clever about whitespace in typeahead for adding subscribers
* Ignore beginning and ending whitespace when submitting the form
* Ignore beginning and ending whitespace when doing autocomplete
* Don't autocomplete on just whitespace

(imported from commit b3231e08f6797a38bafbcef2e694f4bae059c20f)
2013-01-15 17:02:39 -05:00
Zev Benjamin cd60f18752 Add typeahead to 'add subscriber' input box
(imported from commit 49e9a75d3153e1ac97e924a1bdc971df46d6bc10)
2013-01-15 17:02:39 -05:00
Zev Benjamin 5ffc646972 Add control to subscriptions settings to add other users to streams
(imported from commit c013c41f288b438e7462f8024b6c1c6e817e06ee)
2013-01-15 17:02:39 -05:00
Zev Benjamin 4191d2f024 Use a span instead of headings for subscription setting titles
(imported from commit 0453417affe440d411dc018c92c9a41b89b99cd9)
2013-01-15 17:02:39 -05:00
Zev Benjamin 2544cef6bb Add the ability for users to subscribe others in their realm to streams
Right now we mitigate abuse by sending the principal user a Humbug
informing them that they've been subscribed.  Longer term, we want
some sort of stream invitation system, instead.

(imported from commit bf1f1ee0c5d3803cead1ddd9a766ff02043b629e)
2013-01-15 17:02:39 -05:00
Zev Benjamin 526abfccc3 [manual] Add Humbug notification bot user
The production database will need to have this user created before
this commit is pushed

(imported from commit cc8356d8afa0f0747486b7b4c82337c60499d3fd)
2013-01-15 17:02:38 -05:00
Zev Benjamin 82ac1fb317 Don't render the subscribers list for the mit.edu realm
(imported from commit 0577cfd644b55982e8fa0e7bb18cca3f883f8c1f)
2013-01-15 17:02:38 -05:00
Zev Benjamin 67511e2ac6 Show the list of subscribers for each stream on the subscriptions page
(imported from commit 1d092f8ad36d48e1f83df185c2b4f2a9667d4943)
2013-01-15 17:02:38 -05:00
Zev Benjamin 45de8fd25b Add a query to fetch the subscribers of a stream
(imported from commit 286bb42980619a3f8e575a4e2984ad1c4b3fe099)
2013-01-15 17:02:38 -05:00
Zev Benjamin f5e25d2e64 Clear removed_streams when we repopulate the subscriptions table
(imported from commit e9f90425b097f54188e4085828a3fed4c4885954)
2013-01-15 17:02:38 -05:00
Zev Benjamin a1b017eea6 Fetch subs when the subscription page is shown, not when the button is clicked
Fixes #643

(imported from commit c28103c6ec787d1cafa9c845d3b6a771f3c12c05)
2013-01-15 17:02:38 -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
Zev Benjamin 3a127871f0 Move search element event handler binding to ui.js
This is hopefully a fix for #679

(imported from commit cd82f763d904fd5dbed366e56aca664a1b75c496)
2013-01-15 14:19:32 -05:00
Waseem Daher f4d5186541 Rearrange keyboard shortcuts dialog so it all fits on one screen.
So that it is, in fact, navigable via keyboard shortcut.  It's not the
most beautiful way to do this; in the ideal world the layout would be
more properly responsive and could fill up the screen for you when you
have the room for it.

The issue is that the version of Bootstrap we're running doesn't
easily allow for variable-sized modals, and the hassle of showing
and hiding a div manually didn't seem worth it.

The pixel sizes are specified manually as well, in a way that
isn't particularly responsive, because of a few competing
desires:
1) For them to appear side-by-side when wide enough
2) For them to stack when not wide enough
3) The fact that they're awkwardly between a span2 and a span3,
   so we can't just use the Bootstrap responsive layout stuff

Finally, the diff here is best viewed with -w. (I also swapped the
order of Narrowing and Navigation, which unfortunately clutters the
diff.)

(imported from commit 62cfa7959d48ce515562713eb48f9d9b33c8cc16)
2013-01-14 17:37:17 -05:00
Keegan McAllister 67a83e4ef5 tests: Remove inconsistent use of keyword args with InviteUserTest.invite
(imported from commit 5d19da3800ae3c4c63ce22b5cc907f768bf55da9)
2013-01-14 15:58:45 -05:00
Keegan McAllister 38f2498015 tests: Remove set literal in InviteUserTest.test_invalid_stream
This isn't valid syntax in Python 2.6.

(imported from commit 0dc8ef72a27f1c9d559b59d4243948818d1cb75a)
2013-01-14 15:57:54 -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
Jeff Arnold 030fbbccad Autocomplete @names in the compose box
(imported from commit a6df85d4dbeaecaceaa4ed76d1adff4a000392c5)
2013-01-14 13:27:20 -05:00
Waseem Daher 5a77e16fbe Pad out the bottom of the composebox in a symmetrical way.
(imported from commit f0db908755417c6f032b2c02e710fef04032c343)
2013-01-14 13:00:43 -05:00
Waseem Daher 7e9242c796 Reminder of tab-enter to send.
I'd like to phase this out in favor of something you actually
see only when you don't use Tab-Enter, but that's more challenging
than I'm prepared to tackle right this second.

(imported from commit eeda53b0ed69d0e528b00ea9e7c7a20edb35df34)
2013-01-14 13:00:43 -05:00
Waseem Daher b464896fda Decrease composebox typeahead suggestion count to 2.
Now that the box is shorter, we don't have room for more!

(imported from commit 7fd06120df095d46ee087a59f20b745fdd483ca7)
2013-01-14 13:00:43 -05:00
Waseem Daher 5b473a18c3 Have the "New stream/new PM" buttons no longer clear message contents.
If you're currently composing a message and you click one of those, it
now no longer clears out your old message contents, making it more
analogous to the job the old selector used to play.

(imported from commit b935a3bf307bdbd82f1ee7db31d3a3c89c623195)
2013-01-14 13:00:43 -05:00
Waseem Daher bfa1e98e35 Eliminate the stream-or-PM selector.
(imported from commit eda85e19ac6c4557dde14a51f58f1f9a14fc7ab9)
2013-01-14 13:00:43 -05:00
Waseem Daher b25380c8b6 More compact composebox.
Accomplished by:
- Hiding the stream/PM selector
- Eliminating the "tab to send" reminder
- Moving send and formatting links to the right
- Reducing the size of the 'subject' box
- Generally tightening up whitespace

To be fixed later in this series:
- A Tab-Enter reminder
- Completely eliminating the stream/PM selector

(imported from commit 7efe04adcbe373f99a36d3ba23b32944c17aa099)
2013-01-14 13:00:43 -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 bea03548c2 tornado: Don't attempt to populate the memcached on restart.
Later, we can fork off a separate process to do that task, but for
now, we can just rely on the fact that unless the server was just
rebooted, the relevant messages will already be in that cache, and
even if it was, getting the needed messages once each is not a
particularly expensive query.

(imported from commit 6d08eba1b41237fd4e1204e181ce8f227573930d)
2013-01-14 12:28:48 -05:00
Reid Barton 904f55a08e Don't show sender email in skinny windows
It can easily cost an entire line, and the information is available by
clicking on the sender's name.  Plus on a phone, you can't hover
anyways.

Annoyingly, this tends to put the popover partly off the window, but
there must be a way to fix that separately.

(imported from commit 19334cb067981b323e300245654c83c8e545fb2e)
2013-01-14 10:39:20 -05:00
Reid Barton 389a52de6e Fix test for adding to top or bottom of zhome/zfilt
It's possible for selected_message_id to not exist in zhome. For
instance, when you open the page to a narrowed URL, there is a race
between loading the narrowed messages and loading all your
messages. If the narrowed message request completes first, it will
update selected_message_id to your initial_pointer if the latter
happens to be among the narrowed messages. Even if it is not, you can
select a message by clicking on it before the zhome request finishes.

Then the old code would never add that selected_message_id to the
zhome table, so it wouldn't show up in the Home view or if you
re-narrowed.

I'm pretty sure there are still cases where the selected_message_id
might be outside the range of messages in zhome, in which case adding
to zhome might put old messages at the bottom. I observed this twice
on staging but was unable to reproduce it consistently.

(imported from commit 162feff3090f8806cc67140db0cfabb6e965aece)
2013-01-14 10:33:51 -05:00
Luke Faraone f62c97706a Don't assume that PreregistrationUser.email is unique in accounts_home
The schema change made this no longer a guarantee, and creating duplicate
PUs is not harmful.

(imported from commit ca05b4dad7d3cc12a35548817f98c0a072c14c8f)
2013-01-14 10:25:27 -05:00
Luke Faraone fc3fecb1af Add test cases for invite functionality.
This involved splitting off into a separate function the second step of
the two-step registration process.

(imported from commit bd1ec9b5abb15d29b0585873daaa54a8d4e26556)
2013-01-14 10:25:27 -05:00
Luke Faraone 99abad2447 Use custom copy for invites.
(imported from commit 15b306777fd40e7c3feeaaaa871a8936ffc0f651)
2013-01-14 10:25:27 -05:00
Luke Faraone 974c220625 Convert invitee_emails to a set to eliminate duplicate users.
(imported from commit 09e6f7251c4d8d13ce2b4a2808f53e3c9fb97708)
2013-01-14 10:25:26 -05:00
Luke Faraone 75004c65f2 Prevent MIT users from sending invites and hide the button.
(imported from commit 0388c4a2253514e0aba15605bd75a87543479312)
2013-01-14 10:25:26 -05:00
Waseem Daher d9e50117be Frontend for invitations.
(imported from commit 8afab7cc5a4a5c14b605f1b27b48036c9414f7d0)
2013-01-14 10:25:26 -05:00
Luke Faraone 7a43b4e30b [south] Migration for PreregistrationUser
Added field invited_at on zephyr.PreregistrationUser, with a one-time
default of Jan 1, 1970 for existing objects.

Added M2M table for streams on zephyr.PreregistrationUser
Deleted unique constraint for ['email'] on zephyr.PreregistrationUser

(imported from commit 85247acb488201f8fc51dfaae354423c27eddcb0)
2013-01-14 10:25:26 -05:00
Luke Faraone 22a4b76290 [manual] [schema] Add backend function to invite users to the app.
(imported from commit 17ae27b22bdca33e63b96fa8c819759e4f4315fa)
2013-01-14 10:25:25 -05:00
Jessica McKellar 163003b4c1 Lighten the message highlight colors.
(imported from commit c2fc2859efca3ee2ebda5f4ee7c5c02c4a3b6719)
2013-01-11 21:19:16 -05:00
Tim Abbott 4df3c44a97 tornado: Fix order_by query during usermessage initialization.
(imported from commit e39556438ccb6487fe6be3e80d9c3b1e4cdf0cb7)
2013-01-11 16:19:31 -05:00
Tim Abbott 3636f22b2b tornado: Rename receive to receive_message.
(imported from commit 336273048c902941bb65755254bf253c0d130bd6)
2013-01-11 16:11:07 -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
Zev Benjamin 7e62ef5a03 Add a common base class for the RequestVariable*Error classes.
Tweaked by tabbott to make it easier to use for one-off applications.

(imported from commit 6c8e3e6da87c431d9a21e6186fa8952bbaa9e5f6)
2013-01-11 16:11:07 -05:00
Tim Abbott 3b7d61e45f tornado: Get User and UserProfile objects from a memcached.
This commit has the effect of eliminating all of the non-UserActivity
database queries from the Tornado process -- at least in the uncached
case.

This is safe to do, if a bit fragile, since our Tornado code only
accesses these objects (as opposed to their IDs) in a few places that
are all fine with old data, and I don't expect us to add any new ones
soon:

* UserActivity logging, which I plan to move out of Tornado entirely

* Checking whether we're authenticated in our decorators (which could
  be simplified -- the actual security check is just whether the
  Django session object has a particular field)

* Checking the user realm for whether we should sync to the client
  notices about their Zephyr mirror being up to date, which is quite
  static and I think we can move out of this code path.

But implementation constraints around mapping the user_ids to
user_profile_ids mean that it makes sense to get the actual objects
for now.

This code is not what I want to do long-term.  I expect we'll be able
to clean up the dual User/UserProfile nonsense once we integrate the
upcoming Django 1.5 release, with its support for pluggable User
models, and after that I change, I expect it'll be fairly easy to make
the Tornado code only work with the user ID, not the actual objects.

(imported from commit 82e25b62fd0e3af7c86040600c63a4deec7bec06)
2013-01-11 16:11:07 -05:00
Tim Abbott 053543e6eb tornado: Remove normal-runtime query in the user pointers code path.
We still need to do an initial query to get the pointers for all users.

(imported from commit 6ee991a648faf46539fd8676890dedb5f2003d05)
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 b977bce998 Add hack to clean up zephyr/lib/time.pyc -- it will break tests.
(imported from commit f649b31010adc38e3820879fcdd543e81d271d0f)
2013-01-11 15:58:19 -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
Jeff Arnold 3c8b30d043 Revert "Autocomplete @names in the compose box"
This reverts commit d60d1693e77bdd045a1bd20491c6d6efed918b39.

(imported from commit 796036e146eaf917b74dc0bac01e92aa6a682d16)
2013-01-11 13:49:23 -05:00
Jeff Arnold 09a6dc6c42 Autocomplete @names in the compose box
(imported from commit d60d1693e77bdd045a1bd20491c6d6efed918b39)
2013-01-11 13:00:34 -05:00
Jeff Arnold 279ded6072 Notify when we see our username or our name plus punctuation
(imported from commit 158c78de264ef31f61670694764d025a773ae840)
2013-01-11 13:00:34 -05:00
Waseem Daher e3e8d9b939 Revert recent set of floating_recipient_bar changes.
We suspect that these seem to be causing a regression where scrolling
in narrowed views gets really sluggish, but we haven't totally been
able to figure out why since it's challenging to reproduce locally.
(It currently manifests itself on staging but not prod.)

So for now we'll back them out. Here's the full set of things:
Revert "Cause update_floating_recipient_bar to get called less frequently."
This reverts commit a6c1518c4001a2dde44d7b512236795da3ccd351.

Revert "Remove double-scroll in un-narrowing code."
This reverts commit 3dde6c27ffa1e8afa1a084b1b2baee3bc0512962.

Revert "Reset our scroll position if we change our hash to "#"."
This reverts commit 925b44d770c96dafaabebc9e0114f9a3b8f53c4d.

Revert "Properly update floating subject bar when you are at top of page."
This reverts commit 6633cc8a81aedcbb31b30d7c1f27816f8808c700.

(imported from commit a273730581cef30c33bedf701659ee084434f8ad)
2013-01-11 10:58:04 -05:00
Keegan McAllister 0fdc3b772e runtornado: Print busy percentage at most once every 5s
(imported from commit 017bd01f96689f06c6d166bea47b5112fad05f8c)
2013-01-10 17:21:24 -05:00
Keegan McAllister 1d9bcf8da9 runtornado: Report the percentage of time spent outside the event loop
Note that on local dev servers, this will print out every half second, as
Tornado polls for file changes for autoreloading.  In production it will only
print out when network events occur.

(imported from commit adfe88879e4e446b7dfa6ee69e0a9ad013e9c4d4)
2013-01-10 17:07:46 -05:00
Tim Abbott bd05bdd777 Cache client objects in get_client.
This should remove a database query invoked from Tornado by our
decorators in the common case.

We use hashlib.sha1() on the key because memcached doesn't support
keys with whitespace in them.

(imported from commit 351ef4c76bc68e2d53f0e7ddca91dcf95e7bb2a6)
2013-01-10 16:59:36 -05:00
Tim Abbott 77b7c1ead3 Explicitly error out when running tests improperly.
(imported from commit 8224aef3e327010f8ffdcf4dc966a1ccdbb8714c)
2013-01-10 16:59:36 -05:00
Tim Abbott 52589ca6fb Fix running "./manage.py test zephyr --settings=humbug.test_settings"
Previously it wouldn't work due to using the wrong port numbers.

This commit also has the side effect of fixing the fact that our
frontend tests would send real emails and log events to the real
message log.

(imported from commit f2cf400e6061c089627acba2759d588981ecf5bb)
2013-01-10 16:59:36 -05:00
Tim Abbott 536027aa66 decorators: Use select_related() when getting the UserProfile objects.
This should save a database query when we later need to access fields
such as the user's realm name in format_updates_response.

(imported from commit ceef726db9e917cfb0b47061130d7299ee64890d)
2013-01-10 16:59:36 -05:00
Tim Abbott f65ad3d59b Remove obsolete check for empty users string.
This code is from a previous protocol where the users array was posted
as a comma-separate list, rather than encoded via json.

(imported from commit 3a2edfcbf250a7eef305b2e98018c1361cc2fffe)
2013-01-10 16:59:36 -05:00
Tim Abbott 45b9de1e85 tornado: Remove UserProfile database queries from notify_new_message.
(imported from commit a23ce0cf7b8497e2ba7bc048d6fcf373f7ad913d)
2013-01-10 16:59:36 -05:00
Tim Abbott 8fe1edb6b0 tornado: Remove database queries from notify_pointer_update.
(imported from commit 218d5b804a4b4d9f7a1e9305165fd21820c26240)
2013-01-10 16:59:36 -05:00
Tim Abbott c3c59e938c Cache user pointers as they pass through Tornado.
(imported from commit 21a0dc0008ea5d3ac11388d3dd8d8cf8fa8a7e01)
2013-01-10 16:59:36 -05:00
Tim Abbott 62aed7c527 tornado: Move the add_*_callback functions a little earlier.
(imported from commit 2925e345fb9bd44c605350aac631c65a8f0601b6)
2013-01-10 16:59:36 -05:00
Tim Abbott 7274b24018 Callbacks: Reference users by user_profile_id, not user_id.
This is for consistency with the rest of our code dealing with message
delivery, which always uses the user_profile_id.

(imported from commit 5bf10bb9b994b0a98d3a22bd0bd86e542ab8a2ee)
2013-01-10 16:59:36 -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 21c2317bd2 Move callbacks library to tornadoviews.py.
(imported from commit a4e545d82133ae9dc34e283e3bf268225e35f400)
2013-01-10 16:59:36 -05:00
Waseem Daher 66af2da9ed Cause update_floating_recipient_bar to get called less frequently.
Putting update_floating_recipient_bar in the old location caused it to
be called on every single keypress, which is unnecessarily
expensive. Instead, just call it once when we think we might actually
need it: after initiating a narrow.

(imported from commit a6c1518c4001a2dde44d7b512236795da3ccd351)
2013-01-10 14:19:29 -05:00
Jeff Arnold 97e8fb893b Fire a notification for an @name match anywhere in the msg content
(imported from commit 1b6932b1b1094af6f0de2346ca721805e264490d)
2013-01-10 13:44:06 -05:00
Jessica McKellar 1f4f058837 Subtly highlight the selected message content.
Watching new users, I've seen them not notice the pointer and
mix. Give them a little more hinting about what message is selected.

(imported from commit c98e22dcef881ed7400071ec438a6e91d6cd3d9e)
2013-01-10 11:54:15 -05:00
Waseem Daher 7796940c72 Remove double-scroll in un-narrowing code.
select_message_by_id with then_scroll: true already recenter_views
on the selected message; no need to also call scroll_to_selected.

(imported from commit 3dde6c27ffa1e8afa1a084b1b2baee3bc0512962)
2013-01-10 11:38:50 -05:00
Waseem Daher a9112155da Reset our scroll position if we change our hash to "#".
Changing the hash to "#" causes Chrome to jump to the top of the page
on Mac OS X. This commit doesn't actually fix any bug, but it
is necessary for my *next* commit, where otherwise you'd have to
ensure that the scroll code came *after* the hashchange code.

(imported from commit 925b44d770c96dafaabebc9e0114f9a3b8f53c4d)
2013-01-10 11:37:44 -05:00
Waseem Daher 1141bfa888 Properly update floating subject bar when you are at top of page.
There's this very edge-case issue which is: if you go to the top of
the page and narrow to something other than the top message, the
floating subject bar does not update.

Why? Well, the way that the narrowing code works is that it sets up
narrowing and then calls
  select_message_by_id(target_id, {then_scroll: true});
so that our selected message is in the view.

This in turn calls select_message, which calls recenter_view as
appropriate. This usually causes a scroll action, which in turn causes
the floating recipient bar to be updated.

But when we're at the top of the page, recenter_view doesn't need
to scroll at all! So the bar remains un-updated. Here we explicitly
update it to guard against that case.

This fixes Trac #651.

(imported from commit 6633cc8a81aedcbb31b30d7c1f27816f8808c700)
2013-01-10 10:59:03 -05:00
Jeff Arnold 5d5c490613 Disable speaking-at-me notifications for mit.edu
(imported from commit 194c5241311b46f26ecb0b2bb2201b1a7af7b520)
2013-01-09 23:05:02 -05:00
Waseem Daher c206930711 Fade in when you narrow, in an attempt to make it more visually obvious.
I don't view this as a complete solution to
Trac #466 - Make the fact that you are narrowed more apparent,
but it's a start.

(I think a real solution would have to give you something that
helps you make the determination of "Is this view narrowed?"
when you come back to your computer, and this animation does not
help you do that.)

(imported from commit eb3646f3f3a4e25a43266e9146308633fd997eb2)
2013-01-09 21:46:08 -05:00
Waseem Daher 9fb6edfb96 Rearrange code for clarity.
This commit just moves around some lines so that the code that
hides the main view and shows the filtered view, or vice versa,
are together so that it's easier to reason about the sequence
of things that's happening.

(imported from commit 7e99f45293c0e1a4cdfa1a08f41f8c770c370d6c)
2013-01-09 21:46:08 -05:00
Waseem Daher a629f7edf6 Remove dead reference to 'show_all_messages'.
This used to be a button that let us un-narrow, I guess.
A git grep for it after this commit turns up no actual
references to it.

(imported from commit 05acb4bb40da1b032f548c511fbae5b2b20874a8)
2013-01-09 21:46:08 -05:00
Waseem Daher 3a585505a4 Remove the narrow-view 'shadow' pointer.
And change the color to a more thematically appropriate blue.

The shadow pointer is sort of confusing; we should really provide some
different sort of indication that your pointer is potentially moving
on narrow-and-unnarrow. (I think my fade-in-fade-out later in this
commit series is a not-bad first crack at this.)

Resolves Trac #472 - Dual pointers in narrowed view can be confusing

(imported from commit 2450517d99de85ade1c0e98c5510b59e70282451)
2013-01-09 21:46:08 -05:00
Jeff Arnold 7709e21a24 Notify the user when someone is speaking at them
(imported from commit 662ea67b2cf210bfd327ae2db6f924e4424d6d50)
2013-01-09 20:18:39 -05:00
Keegan McAllister aa1df57163 runtornado: Drop call to tornado.autoreload
tornado.web already does this, based on the setting of the 'debug' kwarg.

Dropping this in production saves us waking up twice a second to stat()
a bunch of files.

We already explicitly restart the server on deploys.

(imported from commit 283bb0da609acb2699a04111a74c13224fe5124c)
2013-01-09 15:50:56 -05:00
Waseem Daher 10db1b30f1 Use cached selector for $(window).
Mostly for consistency with the rest of the code around here.

(imported from commit 87539fea96286e1563624efd2a4800df88f2199c)
2013-01-09 15:30:48 -05:00
Waseem Daher 96e66d4c5f Always make sure main_div stretches to the bottom of the page.
If you narrow to a view that only has one or two message, sometimes
the grey box gets cut off and doesn't go to the bottom of the
page. This fixes that.

(imported from commit 55724d03aa30922d91bd33fab4447d889be78889)
2013-01-09 15:30:48 -05:00
Zev Benjamin a01cee3cce Set up frontend tests to run multiple test files
(imported from commit 7eef13df33e8d878efcab199fd4c7eea7fd99a5c)
2013-01-09 14:22:18 -05:00
Keegan McAllister 6cf59f1fba tests.js: Add a note about capturing console.log
(imported from commit a47078b48f0c209e82ce4c9775e9da8f933f7bbb)
2013-01-09 14:03:40 -05:00
Keegan McAllister c4e9d95420 tests.js: Fail if we get a JavaScript error in the page's context
(imported from commit 2f1299ff660b8948ac1451e5724c1f198c7a4e29)
2013-01-09 14:03:40 -05:00
Keegan McAllister 4a9d65c758 Disable desktop notifications in automated testing
CasperJS can't handle them; window.webkitNotifications.requestPermission()
throws a type error.  We can revisit this when we want to write tests for the
notification code.

(imported from commit 90f4d6ac3ddb387e74051b9af2c230698fa94479)
2013-01-09 14:03:40 -05:00
Waseem Daher d2a7d06dea tests: Be more robust about detecting when the subscriptions page has loaded.
We apparently cannot rely on Iago to consistently be subscribed to
"Denmark", so make this determination some other way.

(imported from commit 2a75b345c2d82097ab44538942af89536aac09ed)
2013-01-09 13:27:18 -05:00
Luke Faraone 8c2a9617e7 Do south migrations before running tests.
(imported from commit 94cc702d731838b812dfba27cdd9e24f8d464b78)
2013-01-09 13:18:10 -05:00
Jessica McKellar 95e2948c8a management: add a script to add users in a domain to streams.
(imported from commit e234fe4d283882a5cb2e7a57bcaf8939d973b128)
2013-01-09 11:56:11 -05:00
Tim Abbott b93db35e50 return_messages_immediately: Fix using last=None with dont_block.
Previously, if last was None, we wouldn't check dont_block,
server_generation, or any of the other reasons that get_updates might
return immediately, and just unconditionally entered longpolling mode.

In the process, this reorders return_messages_immediately to have
fewer cases and thus be easier to read.

(imported from commit 67803b8bfc7d9c9c1a4d6916eb2fb62664fb35a9)
2013-01-08 18:17:55 -05:00
Tim Abbott 40a3659844 return_messages_immediately: Remove check for clients with no messages.
This check was a workaround for the fact that the browser client
submitted a "last" value of -1.

(imported from commit a668f6a4e7a0c027f1214166a9bbf40d29b5daeb)
2013-01-08 18:17:55 -05:00
Tim Abbott 550bbe92ea get_updates: Move negative last checking to POST processing.
We shouldn't deploy this change until strictly after we deploy

"Fix website improperly submitting a last value of -1."

or we will break website clients.

(imported from commit 7f682ab0f7060b677f53f0a0073faef216f45d00)
2013-01-08 18:17:55 -05:00
Luke Faraone 3e7d036fca Include autogenerated initial migrations for South.
(imported from commit d1eda0d61ebe8a9d471670133589a1cf8058a802)
2013-01-08 18:14:39 -05:00
Luke Faraone c327446537 Add alternative terms acceptance workflow.
This view lives at /accounts/accept_terms, and (after getting an acceptance
from the user) sends an email to all@ documenting the acceptance.

(imported from commit 8f64286ab02887fd6544fa274b2967f6499b6dbc)
2013-01-08 17:48:42 -05:00
Tim Abbott 39501e5a78 Make the Django-based test suite much faster.
So, I got annoyed that our test suite was taking forever to run:

real	2m13.443s
user	1m32.630s
sys	0m3.748s

Some quick profiling determined that the test suite is spending all of
its time loading the fixtures files (zephyr/fixtures/messages.json)
that it loads for each test case (3s to load that for each test case).
To improve this situation, I cut out from the test database used by
the test suite most of the users, subscriptions, etc. that aren't
being used directly by the test cases.  The impact is a quite
significant speedup:

real	0m15.176s
user	0m9.161s
sys	0m0.508s

We're still spending over a quarter of a second per test, which isn't
great -- but this is at least no longer unbearable.

This commit doesn't make any changes to the populate_db output if you
don't pass the new --test-suite option.

(imported from commit 2334ba5399b33edab3d29ff269fde4ea77ccd48e)
2013-01-08 17:23:55 -05:00
Tim Abbott 5601086575 populate_db: Remove obsolete mit_subs_list.
(imported from commit 601cde1ae95d3e262be8444ded48f1fdca489f7b)
2013-01-08 17:23:22 -05:00
Tim Abbott 83abc08315 Move tornado views to their own file.
(imported from commit e0d9182cbc89a16eedd2846fa17cfba482510565)
2013-01-08 16:53:53 -05:00
Waseem Daher fad7d0a7cb Always show the floating recipient bar.
The initial rationale for hiding the floating recipient bar
was that it duplicated information that was in the "narrowbar".
Now that this no longer exists, let's *always* show the
floating recipient bar.

(Yes, there is some duplication of this information in the
search area, but I think the situation is fundamentally
different now and would basically like to see it everywhere.)

(imported from commit 6fd4506c2f48caade9496139e580e6550252ce8c)
2013-01-08 16:43:50 -05:00
Waseem Daher 105f0aa25a Rearrange calls to then() in frontend test suite.
Apparently after you call waitForText, if you don't specify
a callback function, you need to put the next stuff after
a casper.then() -- not doing so caused some tests to fail
if, e.g. the subscription list did not load super-promptly
(because we checked for the text even before the waitFor
expired; in other words, we were not blocking on it.)

(imported from commit c71d543db0aba0c27b5136b92bb6e28e63278ac5)
2013-01-08 15:52:42 -05:00
Waseem Daher 055652e16d A few more subscription-related tests.
(imported from commit 4d2b47d124bdf0e483363fb7852061bd690d0064)
2013-01-08 13:57:48 -05:00
Waseem Daher 65a474c37c Add test for subscribing to a stream.
(imported from commit e006bcfa5f4c5bbabda839470904689ed1ca5a2b)
2013-01-08 13:57:48 -05:00
Waseem Daher 9ecbff26f8 Very basic "Do the subscriptions and settings pages links work" tests.
(imported from commit f941b8d5f984ffa726266dab50bfab00716c34eb)
2013-01-08 13:57:48 -05:00
Tim Abbott 2d94e4c780 Improve database queries for narrowing to personals with another user.
Inspection of the postgres slow queries log showed that the "narrow to
personals with a particular user" database queries were taking a long
time to run (0.5s+).  Further investigation determined that the OR
gate construction used here was causing the entire zephyr_message
table to be scanned; primarily I think because we were using the
implicit constraint that the logged in user had received messages.

This change makes that query explicit (improving performance), while
cleaning up the code to avoid an unnecessary query and read a little
more clearly.

After this change, the relevant database query takes 10s of milliseconds.

(imported from commit 020f5af5846c958386615e37ea9318383bf99ca0)
2013-01-08 13:42:37 -05:00
Keegan McAllister 83a0d82d8f Don't retry or display connection error if we send bad narrow operators
Alternatively the server could return a successful result with an empty list of
messages.  But I prefer the solution in this commit, because it would allow us
in the future to warn the user about the problem.  It does allow users to
determine if a given stream exists, but we haven't tried to hide that
information so far.

(imported from commit a91e12c90b12d3c870c0b637c3f1d6d3cef88491)
2013-01-08 12:18:31 -05:00
Keegan McAllister 50d229fe11 Accept '{}' to mean 'no narrowing', for old mobile clients
(imported from commit 879f6ef846f2a8980a0574372324d8dc8d22c8ed)
2013-01-08 12:18:31 -05:00
Keegan McAllister 952296bb3d Hide search.update_button_visibility focus override argument from exports
(imported from commit 98201f7c833f9fc4a1c1d6ecdff033e08c28dd5c)
2013-01-08 12:18:31 -05:00
Keegan McAllister 6dea25fd9f Add narrow.by for syntactic convenience
(imported from commit 51300b93a078d54e5111e6bb16ecd9ecbcc295d2)
2013-01-08 12:18:31 -05:00
Keegan McAllister 3af2bf345a Reinstate server-side narrow filtering
(imported from commit 40f63324a8dff404b504b06bddf303b8c1ad5780)
2013-01-08 12:18:31 -05:00
Keegan McAllister 16de6e43fe tests.py: Add assert_json_error_contains
(imported from commit 5a241af5071b6e711b56f84f56a1ed1f7e7dc262)
2013-01-08 12:18:31 -05:00
Keegan McAllister 3455e37160 Get rid of is:pm alias for is:private-message
It's cleaner if the filtering code recognizes only one value.
We can add this back in by converting in the parser.

(imported from commit 453b7b01e094955c6d66be63b5d997cc56b50a35)
2013-01-08 12:18:31 -05:00
Keegan McAllister dbc4798594 Be consistent about when we display search buttons
Show the buttons iff

    - the search input is focused,
    - the search input has non-empty contents, or
    - we are narrowed.

(imported from commit f5c98471a2db4ab522160960dd1271471a9db555)
2013-01-08 12:18:31 -05:00
Keegan McAllister 60f2d06736 search: Factor out show_buttons / hide_buttons
(imported from commit 776f066129e8cf4e298ae90fdd4f62341b36dcae)
2013-01-08 12:18:30 -05:00
Keegan McAllister f3e4b3bc31 search: Simplify event handler setup
(imported from commit b14c4bafb09fa5919e03aac24e968329778a01d6)
2013-01-08 12:18:30 -05:00
Keegan McAllister ddf75b64f7 Un-narrow whenever we clear the search box
(imported from commit 15533579bfbae1644cc76b33348c3cd21a829713)
2013-01-08 12:18:30 -05:00
Keegan McAllister 4ddaf5a2ae Use case-insensitive matching for all narrow operators
We don't require that the parsed form be lower case; that's handled by
narrow.activate.  However we unparse as lower case, in order to give the user a
hint that matching is not case sensitive.

(imported from commit 2882b440deb59a049b095db7a13cfc18e047caec)
2013-01-08 12:18:30 -05:00
Keegan McAllister 3619480673 Handle narrowing operators typed into the search box
(imported from commit 6f758091e2953d00d6a331210aa774b72ba889d5)
2013-01-08 12:18:30 -05:00
Keegan McAllister d2705ab913 Add narrow.describe
(imported from commit df123384754701108fe7597710cb0cf46cb86caf)
2013-01-08 12:18:30 -05:00
Keegan McAllister 6d50e233ec Add narrow.parse
(imported from commit 2275d02c2aee411d07645f7c3d81fdff7d188607)
2013-01-08 12:18:30 -05:00
Keegan McAllister 121ba29abe Simplify searchbox_sorter
(imported from commit cce3d2fd2e56801b43c668c849ef4664edc32a6c)
2013-01-08 12:18:30 -05:00
Keegan McAllister 1fcc7a6185 Rework render_object_in_parts to use switch/case
And rename fields for conciseness.

(imported from commit 77d89085f0786ecdcbb2897e3d171c930b44137a)
2013-01-08 12:18:30 -05:00
Keegan McAllister e202638184 Rework narrow_or_search_for_term to use switch/case
(imported from commit a1296e79d9f6414113a475e407fbaccb54eadb14)
2013-01-08 12:18:30 -05:00
Keegan McAllister 5ee6a9ebca Rename narrow.show_all_messages to narrow.deactivate
(imported from commit 927374756e112abc1042b16caa315af8c1f0baec)
2013-01-08 12:18:29 -05:00
Keegan McAllister ba7ffcead4 narrow: Remove some unnecessary helpers
(imported from commit 307dfec262648bc1fc79d2fb46f8950c7a2f1e2e)
2013-01-08 12:18:29 -05:00
Keegan McAllister 3c9b9227f8 Get rid of the narrowbar
(imported from commit 53335b8177561d4b103659a51704d6b2ce7ec367)
2013-01-08 12:18:29 -05:00
Keegan McAllister 15f606a2ef frontend/tests: Add a function to inject key presses
(imported from commit d2595482ec0bef8b2a4f819e6c29d6e84175a70e)
2013-01-08 12:18:29 -05:00
Keegan McAllister d4d4ea7a8d Display narrowing operators in the search bar
(imported from commit d801128c5b961360939c9e3f3f6f89c8602f987b)
2013-01-08 12:18:29 -05:00
Keegan McAllister 38ff2d9993 Use operators to express narrowing internally
This breaks server-side filtering, for the time being.

(imported from commit 58ec2d7aa593e1c71f835b186535a038faa63239)
2013-01-08 12:18:29 -05:00
Jeff Arnold 78506acd20 Do not send the browser back on backspace when send button focused
Fixes Trac #585

(imported from commit 2b5a02db66cc09ae41da7e6921a31a14c49cf811)
2013-01-08 12:00:57 -05:00
Reid Barton e5ab18276e Move sender gravatar inline in skinny windows
(imported from commit 570c1f6409213fd8a2b6dbb98372dbf2f62ec50c)
2013-01-08 11:28:49 -05:00
Reid Barton c5b4461ac6 Fix outdated comment in CSS
(imported from commit 198e3449b5396f6698b4fb7292ee4921ed326f18)
2013-01-08 11:28:49 -05:00
Jeff Arnold dbb63cb524 Don't continuously bug user if they dismiss the notifications box
Fixes Trac #514

(imported from commit 445af7cf458118be0394491aebbd9996817b08a4)
2013-01-08 11:04:16 -05:00
Waseem Daher 40a8ee48a5 Make stream_list only contain lowercase stream names.
(imported from commit 350f1b20987206c1e910fcc5c2926bd6e96baaeb)
2013-01-07 17:36:37 -05:00
Waseem Daher baba72e3b8 Cause case to be respected when adding a subscription.
And have its colorpicker work.

(imported from commit 998c54153518bb94b7ce41e073078675767694c0)
2013-01-07 17:36:03 -05:00
Waseem Daher 5501558fa7 Only request background color for stream messages.
subs.get_color is expecting a string, and so if you do this on
a PM, it breaks.

(imported from commit acf6d51b84d7bbbe643466f1f72f90a8f6cf16f6)
2013-01-07 17:34:27 -05:00
Tyler Hallada b6e1024b69 Display composebox again upon server errors
Also removed .show()s for the alert on does-not-exist and not-subscribed, where
a blank error would display. This should fix the underlying issue with #166:
that hiding the composebox before send_message() was called would hide server
errors.

(imported from commit a8a50cdf82ddf1d15f1e405432ff3bbfdb7a491a)
2013-01-07 17:03:34 -05:00
Reid Barton c5d37572a7 Document ordering constraint on has_request_variables
(imported from commit efb42cc8478f968ac0dcd390d73bd3d161274fe1)
2013-01-07 16:09:23 -05:00
Tim Abbott 6cd49fbb14 populate_db: Add Humbug error bot.
This is needed to avoid exceptions trying to do internal_send_message
in any test against a simple populate_db database.

(imported from commit 36927f57cbbb7e30ae249b5f1a0549fb352827f5)
2013-01-07 15:06:28 -05:00
Tim Abbott e2292d38b1 Add tests for mirroring of private messages.
(imported from commit 8599d233c98f48a205618f52752a6ce466100d9e)
2013-01-07 15:06:28 -05:00
Tim Abbott dd843b3916 Fix buggy check for zmirror huddle sending to multiple recipients.
(imported from commit 2abc88338225a8a07c50aaf6eb54862885edcb9e)
2013-01-07 15:06:28 -05:00
Zev Benjamin 9b3e4a8bed Don't focus the new stream box after sucessfully subscribing or unsubscribing
If you have a lot of subscriptions that you're trying to modify,
jumping back up to the top of the page is very disruptive.  We still
show the success message, which has the effect of scrolling the page
and is thus surprising, but that's better than the user completely
losing their place.

We do need a story for informing users about failures to subscribe or
unsubscribe, though.  We currently jump back to the top so they can
see the error, but that's not optimal.

(imported from commit 48d938ddc47f286a72e2147f4459b91ca5684e36)
2013-01-07 13:48:19 -05:00
Zev Benjamin 42bf93fb07 Add expandable settings panel for subscription entries
(imported from commit 3c07dcac7ec8086d417c2898a307ee67fc286704)
2013-01-07 13:48:19 -05:00
Zev Benjamin e1a3765644 Give each subscription an id for easier DOM manipulation
(imported from commit 976744174d06abf8bde651ca815d8fe17b8e64ff)
2013-01-07 13:48:19 -05:00
Zev Benjamin 2b4b827715 Fix repeatedly clicking the subscribe/unsubscribe button
(imported from commit e85f2678a4ca896e5a9bd40d37c3713153825c4d)
2013-01-04 18:11:07 -05:00
Zev Benjamin aad09fc267 Merge stream_set and stream_color into a single data structure
(imported from commit 88324e0d296f192feac4f5ecf45f347712cc5914)
2013-01-04 18:11:07 -05:00
Jacob Hurwitz 73a8988df3 Fix tests which were sensitive to ordering of parameters
(imported from commit 87948bb8805a41382ba51152329b33b4f2f03937)
2013-01-03 17:22:21 -05:00
Tyler Hallada 7f06681efa Revert "Add "test" to names of test methods so they run"
This reverts commit a590bf6b8ee733893d3410ecb5eebe54141c48ea. This commit broke
the test suite because it was not tested after rebasing with Keegan's changes
to the tests.

(imported from commit 7248a55328609973c5303be6c85eeb5fbfc1475e)
2013-01-03 16:05:40 -05:00
Tyler Hallada 2cffb7e09b Add test for missing params to ChangeSettingsTest
And add "test_" to the beginning of successful_change_settings.

(imported from commit f5c04517ae3b2140b0b3f7d5012a7044ef601cf0)
2013-01-02 18:46:09 -05:00
Tyler Hallada 3763dca4a6 Return error if confirm_password is filled but not new_password
(imported from commit c58ca8d2f5592c4cf062b963f3cca6673242419e)
2013-01-02 18:46:09 -05:00
Tyler Hallada f276ad2dce Add ChangeSettingsTest to test json_change_settings
(imported from commit 7e83dad9be4ffdfcb3631da6c63b18d85c5714eb)
2013-01-02 18:46:09 -05:00
Tyler Hallada dabdbc8c71 Add "test" to names of test methods so they run
GetOldMessagesTest had test methods that weren't included in the test suite
generated by Runner because they did not have "test" in their names. A few
bugs in these methods that were overlooked because of this were also fixed.

(imported from commit a590bf6b8ee733893d3410ecb5eebe54141c48ea)
2013-01-02 18:46:09 -05:00
Tim Abbott 2125fad6d6 AdminHumbugHandler: Add SERVER_NAME to displayed fields.
For debugging in case this is ever different from platform.node().  I
think this would happen when using a CNAME, for example.

(imported from commit 47f6c3490712a3ac1c6a16f9146c2ef3ca8fc5e8)
2013-01-02 17:36:36 -05:00
Tim Abbott 5a111f6234 AdminHumbugHandler: Fix subject computation in exception case.
(imported from commit 8205d9ab609fa8bad2471d04ac3e4a0a0edb337d)
2013-01-02 17:36:36 -05:00
Jacob Hurwitz e590c914a6 Also change the comment to read 300 ms
(imported from commit e039dca675affa275247280a33bd414705bd44c0)
2013-01-02 17:14:38 -05:00
Jacob Hurwitz af70df0e70 Increasing hardcoded timeout in wait_for_receive
(imported from commit 0662a12891ad4b3dfc11e368901e2dd47bff3daa)
2013-01-02 17:14:38 -05:00
Keegan McAllister ec1e16f6be tests: Better asserts for better failure messages
(imported from commit 18a485c6edf4c2d7d85098950b29c82c7f5ead42)
2013-01-02 16:10:25 -05:00