Commit Graph

246 Commits

Author SHA1 Message Date
Zev Benjamin 814e3d6385 Implement a message list structure for storing messages and related information
(imported from commit 171de93636a215d9357c7fc4ee8fb71696d23fb5)
2013-02-21 13:27:45 -05:00
Waseem Daher b51dc36667 Add a tutorial.js file.
(imported from commit 58b72d08c0cd7815c3c54bd37c4a8033f32cc7ad)
2013-02-20 23:04:49 +00:00
Keegan McAllister 2d3212f3a4 check-all.js: Compact list of globals
(imported from commit c6d67517feaa5f33fa0a25e836ab0fe6ab8edc01)
2013-02-20 16:02:31 -05:00
Keegan McAllister c39e51cc30 Rewrite check-all with various enhancements
- Find Python and JavaScript files the same way, by looking at
  everything in Git with specific exceptions

- Check the non-browser JavaScript, with appropriate JSLint options

Fixes #19 and #387.

(imported from commit 042bd6c26aa7a7ea2209935320ef4da12344b02b)
2013-02-20 16:02:31 -05:00
Keegan McAllister 02ce209b5e Add a generic script to run the right Node binary
(imported from commit cf187323786cf1ee576ec70b6f7db4cbf61d6911)
2013-02-20 16:02:30 -05:00
Leo Franchi 8162d46d5c Mark as unread messages loaded in a narrow view older than pointer
(imported from commit 37362d1fbb4932f064753a5d3d335d9b2bec2964)
2013-02-20 14:05:49 -05:00
Reid Barton 61350d65d1 Render recent dates as weekdays, part 2.
This commit does the actual work of formatting recent dates as weekday
names and updating the format when the date is sufficiently far in the
past.

Also, silence a bogus jslint warning.

(imported from commit 503286fbd9c1e33a81cc7d78cf8d08d5e7f78c1a)
2013-02-19 15:58:25 -05:00
Reid Barton 59dab21fcd Render recent dates as weekdays, part 1.
This commit just moves time rendering logic to its own file, and does
not make any functionality changes.

(imported from commit d111d03c6abc8d9550fcf65e4f89eab8056d1ed4)
2013-02-19 15:58:25 -05:00
Leo Franchi 5d79bb6a20 Add a 'show in home view' toggle to the stream settings
(imported from commit af8bcc4df6fcd9f6ffed4ccb1b9be5261ffe619d)
2013-02-19 15:43:27 -05:00
Keegan McAllister bb5f59d310 Use white text for recipient labels on streams set to dark colors
Fixes #577.

(imported from commit 0518e33b96bc0028fc80d533f6b8ec35fd5cdc04)
2013-02-19 15:33:35 -05:00
Reid Barton 37b5a84af4 Track total number of unread messages
(imported from commit 0a6f270b8a4debf0cbb7e869ecbff59f39f22049)
2013-02-19 13:43:34 -05:00
Keegan McAllister e25d9a8492 Remove unused Notificon library
(imported from commit 8c0717b4e305d28f30b9088a974e99d510ab3021)
2013-02-15 16:19:58 -05:00
Jeff Arnold d0f422979b Change the favicon on notification (great for pinned tabs)
(imported from commit 025ad165d15b2e6d979c246776148f13ebc555fb)
2013-02-12 16:27:07 -05:00
Leo Franchi 83011f7f47 Show a user activity list in the sidebar
(imported from commit 95aaa55c7e4cc39f844518b5308866bedf2cd1c5)
2013-02-11 18:05:57 -05:00
Tim Abbott 2d9a21654b Fix messages being added to the home view out of order.
So here's the reproduction recipe:
(1) Find a narrow that doesn't have any messages since 4 days ago

(2) Directly visit that narrow in your browser (or wait for someone to
do a deploy and thus auto-reload)

(3) Wait until load_old_messages has been called at least once

(4) Un-narrow

(5) Scroll up, and notice that the 400 most recent messages are above
sets of older messages.

The cause is that the code in add_messages assumed that
selected_message_id was within the range of message already in the
home view.  This is true in most cases where add_message is being
called, but it is not true in the case that the user was in a narrowed
view containing only very old messages (And thus selected_message_id
would be older than everything in the home view).

We can fix this by tracking persistent_message_id separately and using
that for the relevant test in add_messages.

(imported from commit f0da2561ba68f729343b260adc398029fae6acf7)
2013-02-08 14:43:13 -05:00
Jacob Hurwitz 61acc58947 Add a notifications bar when there are additional messages out of view
(imported from commit 38fa78f63fd520d0b1f09921ba064cba010a6f99)
2013-02-02 01:16:25 -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 beea0f747e Rename loading_{indicator,spinner} to page_loading_{indicator,spinner}
(imported from commit e1222569f62ac693d45d2f057ef6b05c883c900e)
2013-01-16 14:45:23 -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
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
Waseem Daher d9e50117be Frontend for invitations.
(imported from commit 8afab7cc5a4a5c14b605f1b27b48036c9414f7d0)
2013-01-14 10:25:26 -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
Jeff Arnold db6f03d46d Make the back button work when narrowed
(imported from commit be922b06e7b53ec21751e67a490bb518333c3e6c)
2012-12-19 14:46:31 -05:00
Keegan McAllister 44b9925bfc Configure get_updates timeout in settings.py
(imported from commit 2a647bdd73c43ca5fed704925808efafc70da044)
2012-12-14 16:22:42 -05:00
Zev Benjamin 7e4776322d [manual] Unify huddles and personals into private messages on the receive path
feedback-bot and zephyr_mirror will need to be updated and restarted
when this is deployed to prod.

(imported from commit fe2b524424c174bcb1b717a851a5d3815fda3f69)
2012-12-04 18:01:51 -05:00
Zev Benjamin 46f4a5eb38 Add util module
(imported from commit 3844e136fb799c6f57f8823255addf00a07ef686)
2012-11-30 15:04:46 -05:00
Jessica McKellar 37968bc9c7 If necessary, scroll to avoid occluding the message to which you are replying.
(imported from commit adf23d647a3d462d6236d8f1039da89a31b782d5)
2012-11-30 14:32:41 -05:00
Jeff Arnold b52dbe1ca9 Auto-invoke "Load older messages" when at the top of the page
Resolves Trac #445

(imported from commit d7d96fe82e9e1cbef32e0dde284ce217e83aff55)
2012-11-29 14:18:38 -05:00
Tim Abbott aba2192ec2 Restore the time-travel functionality with Waseem's UI.
This restores the time-travel functionality and fixes Waseem's laundry
list of problems with its original UI.

(imported from commit e30e02c25af994435adb815d26284b3669c945a4)
2012-11-28 22:26:31 -05:00
Jeff Arnold 2f882b505a Show "how many messages have arrived while away" in the document title
(imported from commit 6e2a18be9953694048d107a56a03a67f8bc2bd5a)
2012-11-27 13:39:46 -05:00
Jeff Arnold 4cb0c6225e Add webkit desktop notifications
Partially addresses Trac #31

(imported from commit f1f04b5c50bf9f33b69c90926fd67015cd2dc219)
2012-11-26 14:43:55 -05:00
Tim Abbott 14494d6a1f Add "time travel" feature.
(imported from commit b7b6794ad635ec63269a2043cd48b02749fbffda)
2012-11-20 17:17:39 -05:00
Zev Benjamin 90e0fc6259 Module pattern for ui.js
(imported from commit 951984ec1006e93a0ffc7e299b52fa02c10eb976)
2012-11-19 23:31:22 -05:00
Zev Benjamin da6cc30134 Add abstraction for manipulating userinfo popovers
(imported from commit 155302f103cfef8475482339596eafc594467532)
2012-11-19 23:22:50 -05:00
Jeff Arnold 9ce4c103c0 Implement full history search by creating a narrow for a search term
(imported from commit 3f2df6a6e590458ff774bbd658bbd1d95076a4db)
2012-11-19 17:12:59 -05:00
Waseem Daher f214c2df75 Lay the groundwork for a "typeahead helper" module.
(imported from commit 0b73238e935fac7c13d7152b262d3e71a714f3ea)
2012-11-18 19:41:03 -05:00
Waseem Daher a1c4aa6865 Modularize search.js.
(imported from commit 72f00f832846124d833071fdd46b026c99189512)
2012-11-14 15:29:18 -05:00
Keegan McAllister 122281553a Make csrf_token global
(imported from commit 734d9c886c3a77d2ba40bd449cb089a00807a656)
2012-11-14 13:35:24 -05:00
Jeff Arnold 5c7419307c Fix style mistakes we didn't catch the first time
(imported from commit ae1ca10ea8559702e4e73481715239ff456eca4b)
2012-11-11 13:24:44 -05:00
Jessica McKellar 3af5e246be Don't cache your personal gravatar across gravatar updates.
(imported from commit 06f82faaa350db8a64cebef24b738b5e93bebb98)
2012-11-09 12:44:09 -05:00
Jessica McKellar a2c6975ca2 Be case-insensitive about subjects when collapsing and narrowing.
(imported from commit 0baf20179c037c3eac82d8db20c6ec8062bb136a)
2012-11-07 14:51:51 -05:00
Jessica McKellar ed50c17582 check-all: add missing message mouseover globals.
(imported from commit c04770de18940bfff24598392c08f0ed1cec76d7)
2012-11-07 11:19:47 -05:00
Zev Benjamin 114339dc2a Remove some no-longer-extant globals in check-all.js
(imported from commit f83e19c891d438ed8a2ddd0e2849cd543562631b)
2012-11-06 16:40:52 -05:00
Jessica McKellar 4cad5f6e96 settings: Update name and gravatar without a reload.
(imported from commit 961c9f64d7c39b4345ece036062854e8d474d2c0)
2012-11-06 16:33:22 -05:00
Jessica McKellar c1cc9f0742 Don't re-focus on the search box after ending the search.
(imported from commit 35bffb245ad9dc58b394a1c5228b32db4830f2bd)
2012-11-02 11:04:16 -04:00
Waseem Daher 69b534c0ba Move composebox typeahead code into its own module.
This also cleans up the autocomplete source specifications,
making the three typeaheads all look fairly consistent.

(imported from commit e72655d715db74cfc9ab45b51e7e2ff9e8ea84c5)
2012-11-01 21:56:33 -04:00
Zev Benjamin 696a04743a Factor reload-related functionality into reload.js module
(imported from commit ef533f3416e8b406a03d28f67b45ca59523cef8e)
2012-10-29 17:38:44 -04:00
Waseem Daher 3c3877f1b5 Have Esc dismiss userinfo popover.
It's possible that the three places we can kill a popover
(body click, Esc, clicking on a new one) should be
refactored to use the same code.

(imported from commit ba7eab480fd2258abfb469c8f1155f29bc63f7f6)
2012-10-29 15:49:40 -04:00
Zev Benjamin cee3f87585 Use compose.finish() instead of manually calling ajaxSubmit() in multiple places
(imported from commit 3bbe4a03171d9eace413b576ae2c7ccf99141bf1)
2012-10-29 13:58:40 -04:00
Keegan McAllister 582cb799dd Get rid of the selected_message_class global
Instead we infer this from narrow.active(), with the ability to override during
the narrowing procedure.

(imported from commit fab9c6861f19aedf0ee8af094c1ef4e8a0a73d80)
2012-10-26 21:05:04 -04:00
Jessica McKellar 92593b7cc8 Add basic up/down search functionality, including across narrows.
(imported from commit c82acad95e97733b87d65287c685caf7533a774e)
2012-10-26 14:31:05 -04:00
Zev Benjamin bb64eb717f Make select_message and friends take an options argument
The select_and_show_by_id function is now subsumed by select_message_by_id.

(imported from commit 3dbe9cf9d253b64733f269b6dc78c144100927ca)
2012-10-22 16:06:38 -04:00
Zev Benjamin 88e09c6166 Only reload the page when the user is idle
Also, clean up reload-related function names a bit

(imported from commit 4c2e17c06d7567e71b92f6e1b04a44aeff419bff)
2012-10-19 15:53:05 -04:00
Keegan McAllister 95f8eea14b Module pattern for subs.js
(imported from commit adfe466ea892fbfe5f13a5f346e4fd00f194c42a)
2012-10-18 15:46:58 -04:00
Keegan McAllister 2a2c0187c5 Rename subscribe.js -> subs.js
(imported from commit c3ce92e31916548206ad5752da8911f22d23f106)
2012-10-18 15:42:08 -04:00
Keegan McAllister eb9140a0a2 Pseudo-module pattern for rows.js
It's actually simpler than a full module, due to lack of local state or functions.

(imported from commit b9180f1cdc26aed3f2e1f35dfae9ed4240b64446)
2012-10-18 15:11:25 -04:00
Keegan McAllister 01061e95e0 Rename dom_access -> rows
(imported from commit 66f6f88cf15f5be614440b826433d5c1cfd6803e)
2012-10-18 15:11:25 -04:00
Keegan McAllister e7661f7b2f Module pattern for compose.js
(imported from commit 8ea9d949b793285e8722bebcef30991d06e5673e)
2012-10-18 15:11:25 -04:00
Keegan McAllister c4bf81a312 Module pattern for narrow.js
(imported from commit f1df2e884216560cfe80f29a7e3eda5cea17cefe)
2012-10-18 14:41:24 -04:00
Keegan McAllister 1398641aa3 Module pattern for hotkey.js
(imported from commit 56616bc8eeaa594ca70bb92bf17a88f97027fd35)
2012-10-18 14:35:42 -04:00
Keegan McAllister 91209f9304 Get initial server generation from first get_updates result
Embedding this in index.html won't work anymore, because the Django FastCGI and
the Tornado servers might have been started at different times.

(imported from commit 187909d0593449cf2989857671f9ca526723e451)
2012-10-17 18:24:15 -04:00
Tim Abbott 5c50375e02 Display a message and disable compose while reloading.
(imported from commit f998d2e4053e7e2d676f7fe08ee274118dd9faba)
2012-10-17 14:59:49 -04:00
Tim Abbott 8a7779ad49 Tab should toggle stream/huddle even if you clicked the compose botton.
(imported from commit a705c7cd0d6067dc05da7a64f29fb3ef42838785)
2012-10-17 12:05:43 -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
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
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 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 b42cf1d4c8 Fix persistent message selection across narrows
(imported from commit 958ce299108f8bbc8579e7446053d7fc9f018b81)
2012-10-15 13:25:39 -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 adf75d48e1 Make pressing escape also un-narrow
(imported from commit 17d2cc3e8074af332f98588ad201ec342476d51f)
2012-10-11 14:30:51 -04:00
Tim Abbott ac3f4393ff Rename instance to subject.
(imported from commit 6b4693da03f106448c137cf81cf9801cac44f2b8)
2012-10-10 18:01:39 -04:00
Tim Abbott 413fdeb655 Rename class_name to stream_name.
(imported from commit e610f5de5edf756ef0a71c5361fcd507adbb1605)
2012-10-10 17:48:17 -04:00
Tim Abbott ef3b8a2ce5 Rename class_list to stream_list.
(imported from commit c9f5b10acdb20d3e923cf7f32bc5a3f37aa40705)
2012-10-10 17:48:17 -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 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 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
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 2f910a1629 Show success messages on the subscriptions page.
(imported from commit 771fa4459e6a09ffc4132ccff12372b204334de2)
2012-10-09 15:44:55 -04:00
Tim Abbott 5568e1a79c Move hotkey.js jslint globals into check-all.js.
(imported from commit ec737e658e9f2251025e493abb92e4cf2a7aab72)
2012-10-09 14:11:22 -04:00
Tim Abbott a5c8b5dc7e Detect whether the user is currently in an input area correctly.
Rather than trying to keep track of whether the last thing that
happened was an input area being focused (which had all kinds of
bugs), just detect whether we're in an input area using the
appropriate jquery selector.  Hopefully this has OK performance.

(imported from commit 6150692ffcb0ab9b04244c3d053b5527847ded2d)
2012-10-09 14:11:22 -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
Jessica McKellar 367feda747 check-all: add new viewport globals.
(imported from commit e163dc07ad196ffd2731f7ccc67bfaada8e8580a)
2012-10-05 16:29:59 -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
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
Keegan McAllister ffcbd1ea7e check-all: use strict
(imported from commit 6a4c721be90631d250ca35ba9e26925803f2dd34)
2012-10-04 13:48:24 -04:00
Keegan McAllister 277eb66cf6 check-all: Display actual relative paths
(imported from commit 2c7ed1deb7aadd7b9286d363494437162e8975f6)
2012-10-04 13:41:07 -04:00
Keegan McAllister 3816ca6dfb check-all: Use more fs / path functions
(imported from commit f2b2970efa9b93068f835cd70ca3e3cc7ec22c38)
2012-10-04 13:41:07 -04:00
Keegan McAllister cf85c2e4c3 JSLint: Disallow console.log in general
(imported from commit 8cdff0a702ce2857a4596144d66ac285559226da)
2012-10-04 12:37:15 -04:00
Keegan McAllister 7edfd3458c Add a new tool for running JSLint
(imported from commit 35256825be8793f7e649eb8237111afa05320b32)
2012-10-04 11:04:25 -04:00
Keegan McAllister e7db8857ea Import JSLint
(imported from commit c1380fd9a2d75d84ac33c6a7b3457abcd0f9e4f5)
2012-10-04 11:04:25 -04:00