Commit Graph

352 Commits

Author SHA1 Message Date
Jessica McKellar 19823bdec8 Add a watchdog for your laptop waking up that wakes up polling more promptly.
Without this, if you suspend and resume you wait up to 90 seconds for
long polling to retry.

(imported from commit 5e964c357f395d30107af5b2c934949058c0d3a8)
2012-10-10 15:09:16 -04:00
Waseem Daher 48cda57d84 Fix issue where arrowing-down near end of page would skip a message.
We had this fascinating behavior where pressing a down arrow near the
end of the page would advance the pointer, call recenter_view, which
would trigger a scroll event, which would call keep_pointer_in_view,
which would notice that we were at the end of the page and advance the
pointer again!

I split out that last part into its own function which is only called
on mousewheel events.

(imported from commit bc85443e762356e3055f8f88585940a1f11f9124)
2012-10-10 14:29:15 -04:00
Tim Abbott 18cd32b042 Rename zephyr=>message in remaining local variables in zephyr.js.
(imported from commit 5641ea31b03079e9a0910b2c8451e961cc7cb285)
2012-10-10 10:35:48 -04:00
Tim Abbott 21260d0aca Rename zephyr=>message in add_zephyr_metadata.
(imported from commit 3b174cc645baa00023164c3407bec95e556cc6de)
2012-10-10 10:34:42 -04:00
Tim Abbott 42c05b9690 Rename the zephyr template to the message template.
(imported from commit c15e2cc08d3604a82d90a96efa4f70d101971df4)
2012-10-10 10:32:59 -04:00
Tim Abbott 2170c7a352 Rename zephyrs to messages in various local variables.
(imported from commit 91ac7e47c51fdcaf6559b06f07e36b041aad3e2c)
2012-10-10 10:29:48 -04:00
Tim Abbott 26b5c11d64 Rename get_zephyr_row to get_message_row.
(imported from commit 2480b0bfe0be58cdb6bdf687760967b26ca38558)
2012-10-10 10:19:46 -04:00
Tim Abbott 06ffd206ae Rename respond_to_zephyr to respond_to_message.
(imported from commit 34e7793601ad6f41d71be2e2060c58138b9d3b53)
2012-10-10 10:18:51 -04:00
Tim Abbott 9a359c8d05 Rename selected_zephyr_* to selected_message_*
(imported from commit 04025c4472b893ce12764775e10c1dc89850b639)
2012-10-10 10:17:58 -04:00
Tim Abbott ae97a88e72 Rename selected_zephyr_id to selected_message_id.
(imported from commit bbb368efdd5010b6dfdaaf60f3f48904b40671af)
2012-10-09 22:42:19 -04:00
Tim Abbott 836971d3b3 Rename zephyr_content to message_content.
(imported from commit 05e255ec275a8aeaf3967d6a4305cc4440c81913)
2012-10-09 22:42:19 -04:00
Tim Abbott a62cd32107 Rename zephyr_compose* to compose*.
(imported from commit 103351bbdb7657720d7b7b9f57ee88e5957d09a4)
2012-10-09 22:41:17 -04:00
Tim Abbott f66124cbe2 Rename select_zephyr(_by_id) to select_message_*.
(imported from commit 91619adf0e610017fbef52d2796020cb16537653)
2012-10-09 22:40:13 -04:00
Tim Abbott f1e90cde8c Rename zephyr_dict and zephyr_array.
(imported from commit 5d93fddc1758c0ee47390cfe599732a60a8d817a)
2012-10-09 22:40:12 -04:00
Tim Abbott dfc0b1a4d9 Rename next_zephyr local variables to next_message.
(imported from commit 88f3b5dc3fdde3340dcc4f040cf8ecc8554955bb)
2012-10-09 22:40:12 -04:00
Tim Abbott 864a26acd6 Rename the new_zephyr text area to new_message_content.
(imported from commit b5d09625a9c50865be7a6401e8da95efe06410fc)
2012-10-09 22:40:12 -04:00
Jessica McKellar fb62e808d7 Use an associative array for faster subscription checks.
This also helps us manage checking, case-insensitive, for
subscriptions while preserving the casing used by the class creator
for display.

It also fixes a bug where the class_list would become out of sync with
your true subscriptions, allowing you to appear to send messages to
classes to which you had unsubscribed.

(imported from commit 5e8d017bcfb27a71c52f7517733eda7b926d721b)
2012-10-09 17:28:21 -04:00
Tim Abbott 48a0c65bd6 Clear the class/instance values when replying to a huddle message.
(imported from commit 8953c6a8911503b4d938588e94d2323773f21c6c)
2012-10-09 14:18:55 -04:00
Jessica McKellar e351439d0b Don't have clicking on a sender prepare a personal.
It is confusing, and clicking on it should behave like clicking
elsewhere in the message.

(imported from commit e56434e8e143f6fa58b095e1c7d311b4aa24313f)
2012-10-09 11:01:28 -04:00
Tim Abbott ad9f58d90a Rewrite respond_to_zephyr.
The new version is now the only codepath that we use in order to start
a reply to a message.

(imported from commit dd28316d2640fd5fd712f326690d480b7db59c4c)
2012-10-09 10:40:27 -04:00
Tim Abbott 19a0e4a690 Fix totally backwards comparison and don't recompute the result.
(imported from commit 90b6711b668449aa550e1fdd6412030866e459aa)
2012-10-09 10:27:52 -04:00
Tim Abbott 67c08dfaf2 Set huddle_recipient even when replying to class messages.
(imported from commit dc91d66d87fb1b4c70d7b1842b733282c80b3e4a)
2012-10-09 10:27:52 -04:00
Tim Abbott d510a62976 Rename huddle recipient field to #huddle_recipient.
(imported from commit 8670f06679aa1554003aa2832dec3ed6d00ad1c3)
2012-10-09 10:27:40 -04:00
Keegan McAllister 94e542e3de Modify the right table in add_to_table
(imported from commit 0b4171556cff1e1e46ab1e3c64ec8bc74ac45576)
2012-10-06 17:43:09 -04:00
Tim Abbott 358351d423 Use the new_zephyr form for personal zephyrs, rather than a duplicate.
(imported from commit 741a785efba9ea40b5c1022d710360f086a2d859)
2012-10-05 17:44:55 -04:00
Tim Abbott c02c6cc954 Display the date when either it or the recipient changes.
This is somewhat experimental and we may need to work on the condition
when it shows up (or move it elsewhere).

Also, maybe it should say "Today/Yesterday" for times super close to
now -- the main issue with doing this is whether it needs to update
without your reloading the page to avoid being super confusing.

(imported from commit e29faf30c83b9574e5d233213f42a24175f9a616)
2012-10-05 15:44:15 -04:00
Tim Abbott fc71233b9a Show the sender line again if there is a delay between messages.
(imported from commit fffdb5d5fb5804c44af24e8e8037a7b4af14833a)
2012-10-05 15:42:54 -04:00
Jessica McKellar 7a88fd71e6 Fix broken math for scrolling at the top or bottom of a stream.
(imported from commit 2ba6ab58800b86cd5b31a1b6e235c0be51d985c1)
2012-10-05 14:50:28 -04:00
Jessica McKellar 3166921057 Implement Barnowl-style pointer centering.
This keeps the pointer in the middle 3/5ths of the screen and
asymmetrically handles going above or below those bounds.

(imported from commit 9a6033f53365e6d6cd8f82eb096af849e3b22542)
2012-10-05 14:50:28 -04:00
Keegan McAllister 8bf693224c Fix up attributes on links (whether auto-linkified or not)
(imported from commit cf362db2a2c9500f62b03a89055ac4585ba00a96)
2012-10-04 16:52:10 -04:00
Keegan McAllister 2ebd708a8d Remove client-side linkification
It causes problems when [un]narrowing, and we already do the rest of formatting
on the server side.

This reverts commit 90af0192b37bbebbf56d5e7c50f182485ddbca10.
This reverts commit df7e355648d2c4d6319de049933547ed96402fd8.

(imported from commit 99d87f0826ec2f49741f86fad6524ed93e76723f)
2012-10-04 16:52:08 -04:00
Waseem Daher 93dbb21aff Prevent glitching on scrolling.
This duplicate call to scrollTop is the source of our problems.

(imported from commit 4374e0837d2af5eb20545449469fade7b5d47aca)
2012-10-04 15:47:21 -04:00
Waseem Daher 14daa08726 Restore scrolling behavior in this brave new scrolltheworld world.
There still seems to be some glitching when arrowing around,
which still needs some investigation.

(imported from commit 9c4d8f2b0b55fda5077e2fba70cbe4bcd50b823a)
2012-10-04 15:47:21 -04:00
Waseem Daher 0fcec1aad9 Remove high water mark code.
(imported from commit 308148b2b54709354d219fd7c0ba1ae63f7e7503)
2012-10-04 15:47:20 -04:00
Tim Abbott 2a79ff0cc8 Rename 'zephyrs' => 'messages' when formatting a message list to send to clients.
(imported from commit bfbb556f2444aca8277f54c363eccb678b6bf2dc)
2012-10-04 14:42:38 -04:00
Keegan McAllister f30f10b71d Remove console.log calls in get_updates
We haven't needed these lately.  If we see more problems that need diagnosis
"in the wild" then we can revert this commit.

(imported from commit 3885183d08aefa1f7fd7aa8c2c060e917bf215fb)
2012-10-04 12:35:53 -04:00
Keegan McAllister fcfcf834a1 Replace 'in' with .hasOwnProperty
(imported from commit 209aef184f0a6117d1c14e755e7b916a866b8702)
2012-10-04 11:04:26 -04:00
Keegan McAllister 46a788202d Move go_to_high_water_mark back to zephyr.js
(imported from commit 843199811bf16afd4b54c2b0467b3b18d431b73a)
2012-10-04 11:04:25 -04:00
Keegan McAllister 0830799ce4 Move persistent_zephyr_id to the file where it is used
(imported from commit 1960e61b638a7c2eb832648b71d6f49f6b409b36)
2012-10-04 11:04:25 -04:00
Keegan McAllister c944c08e79 Drop JSLint directives
(imported from commit 5a091b4cb23bae5c307ad19cb772b878d605fbfe)
2012-10-04 11:04:25 -04:00
Keegan McAllister 2f749afc8d Tweak JSLint options
(imported from commit 7e7582a48228b879ea29c2a27eb22e46e093f9dc)
2012-10-03 18:26:00 -04:00
Keegan McAllister 9c6bf90fad Misc. style fixes
(imported from commit b1f32a19a280e3efacf207bfe22bd10eb3aec537)
2012-10-03 18:26:00 -04:00
Keegan McAllister 8e47b33645 Move still more validation
(imported from commit a98d145168abc743888fb4a88dc00c925f138b00)
2012-10-03 18:26:00 -04:00
Keegan McAllister 534cf77265 Simplify validation logic
(imported from commit aec56185fae88c3c51611a15fc11d44fa120951e)
2012-10-03 18:26:00 -04:00
Keegan McAllister d619618fed Move more validation
(imported from commit 62d660a3c34f4aeb170771ee85580362a2c1b8a7)
2012-10-03 18:26:00 -04:00
Keegan McAllister 0c76788ed5 Move some validation functions
(imported from commit e482108981b2b4caa6159060729766b4d224db23)
2012-10-03 18:25:59 -04:00
Keegan McAllister c2ddde2053 Move some settings stuff into ui.js
(imported from commit dea0a6fac11fb3349ac09e90c01d9313ee69c001)
2012-10-03 18:25:59 -04:00
Keegan McAllister ffff63eaad Move some subscriptions-related code
(imported from commit 49f6e525e3aa8a7a5336f713c94e81fee6546dfa)
2012-10-03 18:25:59 -04:00
Keegan McAllister 8d17de1247 Move some early setup code
(imported from commit ca57718e4a71f43bbf229d2a6e8c70174bb3583f)
2012-10-03 18:25:59 -04:00
Keegan McAllister 50d84e9ca8 Move some UI-related code
(imported from commit 28dc554ed91c14f8a8b4be282a211d3d50cf9873)
2012-10-03 18:25:59 -04:00
Keegan McAllister 37f8445318 Split more files out of zephyr.js
I would like to have split this into several commits, but it's hard to do
incrementally, because functions need to be defined before their use in global
data.

(imported from commit 31533396b236f3b657950b073982c317256f082a)
2012-10-03 18:25:59 -04:00
Luke Faraone 3a7dda5099 Replace usage of send_status.toggle() with the more clear .show()
(imported from commit 0593222b16bf845b7bcd9075d02c156a05764c12)
2012-10-03 13:56:35 -04:00
Waseem Daher 2c294694fd Restyle narrowbar to avoid wrapping.
Previously, when we narrowed on a super-long class/instance or
a huddle with lots of people, the box overflowed. This is an
attempt to fix that, even if it isn't the prettiest.

(imported from commit 4eb58726a4c4714bd5435a791ad8fea0eabb58ed)
2012-10-03 13:38:33 -04:00
Keegan McAllister 66265aa5bf Get rid of the send status bar for non-error conditions
(imported from commit 999ca5a02e95f4756e00b4769260f5a84e2440da)
2012-10-03 13:15:22 -04:00
Jessica McKellar 97542d1eb5 Re-focus on new subscription input box on an invalid subscription.
(imported from commit d4876dc43eabe73655928db58ca5ad1ed74fa336)
2012-10-03 13:08:33 -04:00
Jessica McKellar aa2e4efc2c Fix typo preventing focus on new subscriptions box after tabbing over.
(imported from commit 45a6dd8e514a2233517cfaea5a5c0b8d94c62f46)
2012-10-03 13:05:58 -04:00
Jessica McKellar f4e04a045a Focus on new subscription text box after adding a new subscription.
(imported from commit d23bc2d15cce67bc75c2f4ef406de73373b8f3ea)
2012-10-03 13:05:58 -04:00
Keegan McAllister 6cdd1c3e8b Re-select the selected message by ID after prepending
(imported from commit 24f6f17bee8c041fce39a710b8b77f14d3ef7dbe)
2012-10-02 18:39:21 -04:00
Keegan McAllister f03efcd788 Simplify initial pointer selection
This code had decayed from something more substantial into a kind of silly loop.

(imported from commit a6668c19bd6d50325460ac4fa4146d7f82fec58b)
2012-10-02 18:24:54 -04:00
Keegan McAllister 8bc01c85f1 Collapse new with old messages when prepending
(imported from commit 0279183c9a2c70b1fe42f60f4423327aaf2dc7b8)
2012-10-02 18:24:54 -04:00
Keegan McAllister 6baacf6815 Exit add_to_table early if we have no messages
(imported from commit 3860d97344f6008d57829c0040363eb8491ec231)
2012-10-02 18:24:48 -04:00
Keegan McAllister 10201460c8 Allow passing the table name to get_zephyr_row
(imported from commit 098e64b5003eb7844f8d5ccd8aefd982af1b5c6e)
2012-10-02 18:24:03 -04:00
Keegan McAllister b8cca0a094 Track the groups of collapsed messages in each table
(imported from commit 26df33856966f2ac4dc86de9f3436b4499c17089)
2012-10-02 18:24:03 -04:00
Tim Abbott d2884ba456 Make connection errors disappear more efficiently.
Previously, connection errors would stick around after a problem with
the server until (1) the server was fixed and (2) we later received a
message.  This code change eliminates condition (2) by having the
server return immediately with no messages in the event that the
client has accumulated a large number of errors.

(imported from commit 6a9b08e534db6daea0041a71556ef5b708e935ed)
2012-10-02 17:46:06 -04:00
Keegan McAllister 5fe3787ded Maintain one layout-setting row at the top of each table
(imported from commit b375ea78d79ca39b486d124256d0d4e89558d83a)
2012-10-02 17:21:20 -04:00
Jessica McKellar 52327a0484 Give a more accurate error message on new subs from home view.
(imported from commit 5521e27ad63717d5a8ba325172726619bc8114cf)
2012-10-02 17:17:27 -04:00
Jessica McKellar abb47a6a7d Fix bad class name comparison in add_zephyr_metadata.
(imported from commit 7e03ba4a4b3b8af5b080a273a0b480743b1b7e90)
2012-10-02 15:58:17 -04:00
Jessica McKellar 588db5b4c5 Make class names case-insensitive.
(imported from commit e76e50156ca8dab1f7b3124351997e75ef08e521)
2012-10-02 15:16:26 -04:00
Jessica McKellar 2f1a3dd39c Don't allow empty class/instance/recipient/message on zephyrs.
(imported from commit 2f8e6e0d6a2f046208f5d10d495e50d72197f79f)
2012-10-01 18:14:27 -04:00
Keegan McAllister ae228a9a70 Remove unused get_all_zephyr_rows
Arguably incorrect in the multiple-tables world.

(imported from commit 6902972a12c6484e78750d055292510d9637cf42)
2012-10-01 16:42:00 -04:00
Jessica McKellar 28e668bb46 Handle home view subscriptions error cases.
(imported from commit 7f31b5c4837c524c3ad5a0538ca1f01ad73141a3)
2012-10-01 15:36:10 -04:00
Luke Faraone 160744788a Disable hotkeys when preparing a huddle after clicking on a username.
(imported from commit a27ed2734dc3e8ca1a9a1aba8f672c10a6a6fb92)
2012-10-01 15:20:25 -04:00
Keegan McAllister 4bd3f009c0 Prepend to zephyr_array if where === 'top'
(imported from commit f1150f36bedd07275749ca7c8dfd84296ebc9438)
2012-10-01 15:03:16 -04:00
Keegan McAllister 25eeaabe47 On load, send a range around the pointer, then fill in later, then earlier
This still doesn't handle collapsing entirely correctly for the backfilled
messages.

(imported from commit d1fa3e2249968208e735454c27b8cab20bb78d3f)
2012-09-28 19:40:45 -04:00
Keegan McAllister 8d906c9b6f Allow the server to prepend a block of messages
This doesn't handle collapsing yet.

(imported from commit 85a2284f398dea33cc891297924ff7504304be94)
2012-09-28 18:37:12 -04:00
Keegan McAllister 1c48599824 Refactor add_messages slightly
(imported from commit 61ac3285c9a55202f390a3b4473483656449cf44)
2012-09-28 18:37:12 -04:00
Keegan McAllister e9f70c1efb Track the first received message
We don't use this information, yet.

(imported from commit 24a9466823f3e7a287027969d3841c7638954e76)
2012-09-28 18:37:11 -04:00
Jessica McKellar 1fa3bbead9 Update the class subscriptions upon subscription removal.
This fixes a bug where if you unsubbed from a class and then tried to
send a message to it, you could without error and wouldn't see the
message.

(imported from commit 7a4da2a6cb5bbecfc236628dda7b61972b3082e1)
2012-09-28 17:24:45 -04:00
Waseem Daher 8b08cffcbb Faster composebox show and hide.
(imported from commit 55f0465e9aded7c1b8cfe6e53b25bd1bc1185311)
2012-09-28 16:17:29 -04:00
Jessica McKellar 1adb10d1ae Allow copying and pasting from zephyrs without triggering a compose.
(imported from commit f98a14155904dda11d85ed81acee783494377e4d)
2012-09-28 15:27:39 -04:00
Waseem Daher ecfed97bc6 Attempt at restyling personals for more emphasis.
(imported from commit 28adc1c6144632bf973272b096a22d8315648502)
2012-09-28 13:32:59 -04:00
Jessica McKellar f2b808a976 Now that mouseover doesn't select, show_email needs to take an ID.
(imported from commit dfa737e78da0772e99fda34318ed879896fb5655)
2012-09-28 10:59:39 -04:00
Jessica McKellar 9cbdbc4893 Don't update the selected zephyr on mouseover.
But do keep the pointer on the screen as you scroll, and smoothly
scroll all the way up to the top or all the way down to the bottom.

(imported from commit 6acad2a16339ee5eeeebd62a853000c21e4b7152)
2012-09-28 10:59:38 -04:00
Keegan McAllister 3429e77178 Don't display the "Loading..." indicator if the user has no messages
(imported from commit a050218ccde3b82c570a9373cbab5e3fb22abcde)
2012-09-27 16:15:10 -04:00
Keegan McAllister 20240d869c Rename get_updates_longpoll to get_updates
(imported from commit 15635904584b324bdfa1414caea12c3bc4ce54c8)
2012-09-27 15:46:36 -04:00
Keegan McAllister 9323abddd9 Don't jump the pointer if the user already selected a message during load
(imported from commit 69a3f11059ee4764f1625df7774ff611fff99537)
2012-09-26 17:53:06 -04:00
Keegan McAllister 35dcc04822 Add an interim "Loading..." indicator
We will probably re-style this eventually.

Also, the animation freezes during template rendering.  And the HTML is a "give
up and use tables" situation.

(imported from commit 847374b616dc7ce909834f23d5ed9522aa457254)
2012-09-26 17:11:00 -04:00
Keegan McAllister 1e02fc140b Make add_messages do everything relating to message adding
Now that it's only called from get_updates_longpoll, we don't need to break out
specific parts that are only needed there.

(imported from commit 60d1cb25d0044ed1b2325d977b869617587e6a0f)
2012-09-26 17:11:00 -04:00
Keegan McAllister 017c5e87bd Update autocomplete only once per batch
...not up to three times per message.

(imported from commit 1da13c0bc1311627f1bcdce6719097836d9616ca)
2012-09-26 17:11:00 -04:00
Keegan McAllister 21d76b3398 Don't send instance_list in index.html
It gets populated from the zephyrs we receive in the initial get_updates_longpoll.

(imported from commit 83c773d211ea323233a986ccf12fd797236c08a5)
2012-09-26 17:11:00 -04:00
Keegan McAllister 12e458df80 Get initial messages from get_updates_longpoll
(imported from commit 2bb9c51409735abe23bad758338b13121aea4c99)
2012-09-26 17:10:59 -04:00
Keegan McAllister ee75f7ae8d get_{next,prev}_visible: Handle undefined argument
(imported from commit 07956fb7595e8c39fd052aaf0a16df4c3e574f8d)
2012-09-26 17:10:59 -04:00
Tim Abbott df01b016cb Display short_names rather than email addresses for huddles.
(imported from commit 6509305f1b0ee90cfe5c93c74e03350a557a0cc5)
2012-09-26 15:32:35 -04:00
Keegan McAllister bec1b55930 Use switch/case in respond_to_zephyr
(imported from commit 4afef9103075a00772f3c0e29d634a28cb5d5b5a)
2012-09-26 15:25:46 -04:00
Keegan McAllister d8714ae3ff Use switch/case in add_zephyr_metadata
(imported from commit f5a2357a4359d3e16d22a0c561561c5f54b16538)
2012-09-26 15:25:45 -04:00
Tim Abbott d374312509 Use email address for huddle display recipients.
This fixes replying to huddle messages.

(imported from commit 8e6f9ce7d690c926b19c50016ec972d767428994)
2012-09-26 13:24:08 -04:00
Jessica McKellar f60e9de1f2 Linkify URLs in zephyrs.
(imported from commit df7e355648d2c4d6319de049933547ed96402fd8)
2012-09-26 10:33:33 -04:00
Jessica McKellar 455b9863d5 Always clear compose inputs on New Message.
(imported from commit 7c32f8bdc2366695c488563698c282d2f25b65a1)
2012-09-25 13:39:23 -04:00
Jessica McKellar 14ceb7e888 Add hotkeys for composing a new message and toggling betweeen message types.
(imported from commit 5778b12d204f803a4c46b0f32ec19d9410108b36)
2012-09-25 13:00:43 -04:00
Jessica McKellar 810229288b Track and be able to return to your high water mark.
(imported from commit 52a1ce8c84ad3f4eea16b7abaf075ebffc794c9a)
2012-09-25 10:04:34 -04:00