Commit Graph

425 Commits

Author SHA1 Message Date
Tim Abbott d2343813df Add 'C' hotkey to start composing a huddle.
(imported from commit 693aeba202a06465dd41e46d78491ecfe23e97f6)
2012-10-17 11:55:21 -04:00
Waseem Daher bf73a54576 Have Spacebar exhibit the same scrolling behavior as PgDn.
(imported from commit 46a1204a9a8b973e7fa6bae9c65a9dc9f341077c)
2012-10-17 11:25:38 -04:00
Waseem Daher 2d4857d6c1 Remove extraneous calls to keep_pointer_in_view.
PgUp, PgDn will already call the scroll handler, which will
of its own accord call keep_pointer_in_view.

(imported from commit 8b6e53eaeda91d0f35775de72e16d63dc6c8340b)
2012-10-17 11:25:38 -04:00
Waseem Daher 93954177f9 Code a little more defensively in update_floating_recipient_bar.
That andSelf is only necessary if a .recipient_row were immediately
followed by a .bookend_tr, which, I don't know, after a redesign could
very well be the case, so let's guard against it now, especially since
our performance on scroll is currently pretty good.

(imported from commit 1011555fbfd30943b4aa917997d6e35bcce959fc)
2012-10-16 17:26:02 -04:00
Waseem Daher 433ac07b37 Very very slight speedup in get_next_visible/get_prev_visible.
In my limited trial, this sped the call up, on average, from
0.507ms to 0.473 ms... so, admittedly, not a lot.

I think this is a little conceptually cleaner, though, and it handles
the common path with the least work, which I like.

(imported from commit c8b827a2e8111fbdd54bcabe05ac36f64523c466)
2012-10-16 17:06:36 -04:00
Waseem Daher b730dc7983 Huge speedup in get_next_visible/get_prev_visible.
nextAll/prevAll walks the entire DOM, basically.
This code only walks the DOM until we find a new .message_row.

This speeds up the average time of a call to this function from about
6.38ms to 0.678ms, in my benchmarking.

Admittedly, the whole outer loop here could still use some
optimization, if we want to; do we really need to call this 1000
times?

(imported from commit 852e2f660a16f8cfd7be35d3271aedb1ac481663)
2012-10-16 17:06:36 -04:00
Waseem Daher cada47a981 Slight speedup in get_next_visible/get_prev_visible.
http://api.jquery.com/first-selector/ mentions that using ":first" in
query selectors can be a little slow since we can't use the browser's
native querySelectorForAll implementation.

In my tests, this cut the average time down from 6.70ms to 6.38ms.
So, not great, but this function is most frequently called
many times in a big while loop, so, better than nothing.

(imported from commit d7725edd0c81431829fe353c6dd2bc61b1de6b19)
2012-10-16 17:06:36 -04:00
Tim Abbott 94944d2c5e Fix updating the pointer.
(imported from commit e0214c59c7c14b3c6791e4da205386253f6861c1)
2012-10-16 16:56:21 -04:00
Tim Abbott 6642a65269 Convert last few json views to use the json_success api.
(imported from commit 7a617ec7e7c8607e8ba87e7a9b8599a83b91666c)
2012-10-16 16:54:41 -04:00
Tim Abbott a859c10017 Don't redirect to a login page when responding to json messages.
Also update tests to actually check all our URLs.

(imported from commit 86de2027d140da6118e2f2f60c1c86511b16c141)
2012-10-16 16:38:39 -04:00
Tim Abbott 3e994c16b7 Rename/reorganize our urls to be more consistent.
(imported from commit ca3cc7ccd5d7da83a9c60968527378ee1118648e)
2012-10-16 15:56:06 -04:00
Zev Benjamin fab64fd7b0 Make the client reload the page when it detects a server restart
If the client is not composing a message, we can just force a page
reload.  However, if he is composing a message, we must preserve that
message while still reloading as soon as possible.

We take the following approach: if the client has not completed the
composition after 5 minutes, do a compose-preserving reload
(described below).  If he sends the message before the timeout
expires, reload the page after a successful send.  If the send fails
(not due to server timeout), however, we do a compose-perserving
reload in case the error was due to the data format changing.  If the
send failed due to server timeout, we don't reload because the reload
will probably also fail.

In a compose-preserving reload, we redirect to an URI that has a
fragment indicating we are doing a reload and containing all the
necessary information for restoring the compose window to its
previous state.  On page load, we check the fragment to see if we
just did a compose-preserving reload, and, if we did, we restore the
compose window (or just try the send again in the case of send
failure).  The URI fragment looks like:

(imported from commit af4eeb3930c24118e088057d4da456748fbd2229)
2012-10-16 15:30:41 -04:00
Zev Benjamin 103bf321b4 Have client and server exchange a server generation number
This will allow the client to detect when the server has restarted.

(imported from commit 89e75916719d967beb2520be6263f79f897d9ec1)
2012-10-16 15:30:09 -04:00
Zev Benjamin 24c1a2d7f1 Make compose box accessor functions also be setters
(imported from commit ab568cc2c224b8558148f158d1c9c1f89bb1eb49)
2012-10-16 15:30:09 -04:00
Waseem Daher ea7770c4b7 Properly handle mousewheel events when we're simultaneously at top and bottom.
(imported from commit 72efb1c52b5aed759150d9d2fe82ca619a25ff35)
2012-10-16 12:16:26 -04:00
Waseem Daher ca1dcf222f Don't allow the top of the pointer to be past the 2/3 mark.
Given that we now look at the top of the pointer rather than the
bottom for this check, our previous 4/5 number was far too permissive
(and led to your selected message often getting covered up by the
compose window).

Anecdotally, this feels a bit better to me.

(imported from commit 39ca7924db56272f7e623708ce0125b2a7012656)
2012-10-16 11:46:17 -04:00
Waseem Daher fc5287e7ed Redo above_view_threshold/below_view_threshold to prevent glitching.
In particular, we had this issue on huge messages. Suppose you had a
huge message and were scrolling up from the bottom. Initially it would
get selected as the message underneath it was below the
threshold. Then, when you scrolled again we said "oh, well, the top is
too tall, it's also *above* the threshold" and moved the pointer back
down. So it glitched back and forth.

Now we consider you above the view threshold by looking at your
bottom, and below the view threshold by looking at your top, which
seems to resolve this issue.

(imported from commit 2434d1103ab3fa894ade612ac1fb10b2f3cd66cf)
2012-10-16 11:46:17 -04:00
Waseem Daher ca7855e03e Use outerHeight instead of height.
I think this'll allow for a slighlty more accurate drawing of our
floating recipient row in the even that some of these things have
borders and others don't.

(imported from commit 31714f7356604e1d9c64bcc7f6fd14b8a02a99b5)
2012-10-15 22:47:42 -04:00
Waseem Daher b76422d8d0 Cache the window selector as 'viewport' in an attempt to improve performance.
(imported from commit 3e01382260938737fbee663f6a9e94ad495ef21e)
2012-10-15 22:47:42 -04:00
Waseem Daher 45629a362d Break apart the scroll and mousewheel handlers.
I'm actually not sure if this is a performance gain or not; I guess it
depends if any of the stuff inside mousewheel or scroll took longer
than 50ms to call (and right now it does).

(imported from commit e3fcc4a14cd8787fa2357a43ed878ab08646e4f2)
2012-10-15 22:47:42 -04:00
Waseem Daher d51aec272d Rename. More consistent references to floating_recipient_bar.
(imported from commit 7bfd2bf55ede0604349faf06944c551a0d23fb73)
2012-10-15 22:47:42 -04:00
Waseem Daher 1c56ad00c9 Optimize update_floating_recipient_bar's showing-and-hiding code.
(imported from commit 6cd67d9c7bf418ae78288363636ee75fdc3fcada)
2012-10-15 22:47:42 -04:00
Waseem Daher 1781a4a616 Optimize update_floating_recipient_bar's "pick a subject/stream" code.
(imported from commit a6e615a3939fb072cc9cd310e653f13d690a55cc)
2012-10-15 22:47:42 -04:00
Waseem Daher daf06b9beb Hack around visibility: collapse for Chrome.
(imported from commit 25e6453fe6fa1c5a3c72f56bec2e4bbb089edb4f)
2012-10-15 22:47:42 -04:00
Waseem Daher 4d914df68b Rename things.
narrowbox -> top_statusbar
narrowcontent -> narrowed_to_bar

floating_indicator -> floating_recipient_bar
fixed_narrowbox -> table.floating_recipient

(imported from commit 7b5bbb17aeff9372275311ab09cd3cbf8262ea13)
2012-10-15 22:47:41 -04:00
Waseem Daher acb75ecf67 Only float narrowbar when #home is active.
(imported from commit a2da9b5a41e5a645d0c72ef48ff4a856558bed15)
2012-10-15 22:47:41 -04:00
Waseem Daher a80ba151b0 Eliminate scroll direction detection.
(imported from commit 2aa8665c9ffa137830fc871061d7e72ba5ccfc6f)
2012-10-15 22:47:41 -04:00
Waseem Daher 6015d1d928 Refactor the 'floating stream/subject' bar.
(imported from commit 76528653c29809bc461693b069140bfdfbeec97b)
2012-10-15 22:47:41 -04:00
Waseem Daher d95b4a30e2 Resize the narrowbox, not the 'narrowcontent' when we shrink.
This allows us to put other stuff in the narrowbox and have
it also magically get resized. At least in theory.

(imported from commit 92975e3d0893b34d52cad910462cbf2ccaed2eab)
2012-10-15 22:47:41 -04:00
Jessica McKellar d07f4c05f3 Keep the top-most recipient row floating at the top of the screen as you scroll.
(imported from commit e597b60c86f5b38a55dc78df80d84dfe112c8d8f)
2012-10-15 22:47:41 -04:00
Zev Benjamin 828fc05da5 Don't display one's own email when replying to multi-person huddles
(imported from commit afcf48e17b3dc6f1103f089f8746d462e90c0db7)
2012-10-15 15:57:41 -04:00
Zev Benjamin 084608ebda Clear compose box when replying to a message
(imported from commit 1fe21a6d1a5f6f946e14583dc81ede961dbf57c9)
2012-10-15 15:45:15 -04:00
Zev Benjamin 8f3aea5cbf Fix narrowing to personals with a specific user
(imported from commit 06f84dd056e8212cb146a17bec37d0bbe63651d0)
2012-10-15 15:40:55 -04:00
Zev Benjamin a85c1f62d2 Visually distinguish when a message is persistently vs. temporarily selected
(imported from commit d626b3460a3a3ad46bd9ebfb65d73a6c267c2251)
2012-10-15 13:25:39 -04:00
Zev Benjamin 0bf78df2f6 Display full names in narrow description for huddles
(imported from commit 665df20d129df4d7e516f145f064b90c6e0f34af)
2012-10-15 13:25:39 -04:00
Zev Benjamin b42cf1d4c8 Fix persistent message selection across narrows
(imported from commit 958ce299108f8bbc8579e7446053d7fc9f018b81)
2012-10-15 13:25:39 -04:00
Tim Abbott cd14988b47 Reset the failures count to 0 when restoring from suspend.
(imported from commit 11b03f8a0565063cc7381dd32a96af79bd26a0d1)
2012-10-15 13:20:54 -04:00
Tim Abbott 4062550ef7 Fix tab not toggling the compose window in Firefox.
(imported from commit 4dfd3d6eb3e81c519d0aefbfe0b3b1390adb241b)
2012-10-15 10:45:31 -04:00
Tim Abbott db3c40fad1 Don't display yourself on list of huddle recipients.
(imported from commit 17919c153ad380adbb0a9dc2c111ea1686603414)
2012-10-12 18:41:04 -04:00
Tim Abbott ec1533b0b1 Fix display of huddles.
(imported from commit c894411331fd0fa905d0c72d5cfa78317fad8c2b)
2012-10-12 18:37:34 -04:00
Tim Abbott 89aa539024 Display fullnames for headings on huddles and personals.
(imported from commit bfd296bd962b6c44d4da3e5dfa1a6791c4c46b8a)
2012-10-12 18:35:28 -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 827cc31aa7 Be more efficient about adding new people to the people list
(imported from commit ff0a891fd8f60b01308c6be21d3f8eb645d4ee31)
2012-10-12 18:18:04 -04:00
Zev Benjamin 09deef9611 Improve autocomplete for multi-person huddles
(imported from commit 3dacbc6b8c8470177844987e509bc1d413a10766)
2012-10-12 17:29:52 -04:00
Zev Benjamin bc4487ebf9 Fix autocomplete
There were two issues:
* The people_list population changed and I failed to noticed
* Typeahead source updating never worked before because calling .typeahead()
  more than once does not change the data source

(imported from commit fda14029f4cd37260d82e7bb5689f5022e1b0d28)
2012-10-12 16:57:27 -04:00
Zev Benjamin 35342481dc Scope subject autocomplete to the stream
(imported from commit 6e9972c93d5f56f29db37b522e20768b8fb641df)
2012-10-12 13:15:06 -04:00
Zev Benjamin 88009b4854 Auto-complete huddle names based on full name.
This also makes the people_list a list of objects containing the person's full name and email.

(imported from commit cff9b3de8cab0c9b2690ffa60d65d666302b989f)
2012-10-12 11:35:45 -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
Waseem Daher 22099dfe9f Fix scrolling bug related to resize.
When Bootstrap shrinks the divs down into 'tablet' mode, our selected
message might end up being even lower in the screen than it was before
(because more text wraps). But our scrollbar does not automatically
advance to keep it in view -- so we do it manually.

This implementation is a little hackish in that it does some
unnecessary recenter_view-ing in big views (which can be a touch
disorienting) to optimize recentering on resizing for small views.

If that behavior is annoying, we can deal with it by being
smarter about when we trigger the recenter code.

(imported from commit 6834e11f7a37833982c388f15174df661d7f55b3)
2012-10-12 00:17:24 -04:00
Waseem Daher 04b0000d83 Embarrassing typo fixes.
(imported from commit 0ea86386e3d4269be63610f4729b1f1762cdc0b7)
2012-10-11 22:49:18 -04:00