Commit Graph

2801 Commits

Author SHA1 Message Date
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
Jessica McKellar 2c6ac969ff Temporarily increase get_updates polling timeout to deal with increased load.
(imported from commit 8477c829f1f69299ddb9c22dee722825dd673ee7)
2013-01-09 21:07:43 -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 0646cd7e21 [manual] Convert Humbug to use Django South.
This was done using instructions provided by the South authors:
	<http://south.readthedocs.org/en/0.7.6/convertinganapp.html>

This adds a dependency on python-django-south >=0.7.5. Now when you are
reinitializing the database, you need to run "./manage.py migrate --all"
before running populate_db.

When deploying this commit onto existing servers, you need to run these
commands manually:

    ./manage.py syncdb
    ./manage.py migrate zephyr 0001 --fake
    ./manage.py migrate confirmation 0001 --fake

These do *not* need to be run on new databases, only on existing ones.

(imported from commit f24cff421a6be9ab9cf4c4342565c484ac336e2d)
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