Commit Graph

961 Commits

Author SHA1 Message Date
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
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
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 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 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 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
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
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
Jeff Arnold ff57c9af59 Immediately load_old_messages when the user arrives via a #narrow URL
(imported from commit 9705cbb70f9ce62ea5e362212ac91daf1b97ff13)
2012-12-21 12:13:42 -05:00
Jeff Arnold 8b56de22e0 Make #narrowing to a stream with no recent messages not error
(imported from commit b8f0ff9b81876927a59139385d52a9ace96f7559)
2012-12-21 12:12:08 -05:00
Tyler Hallada a3ccfdc78f Set bottom_whitespace height on resize with js
CSS height percentage was not working because parent div has an undefined
height, so instead it is set to 40% of the window height on resize (and initial
load) via JavaScript.

Fixes trac ticket #24.

(imported from commit 2c6a8489585c4bf70c44469ce8628264ec3fbc36)
2012-12-20 22:41:47 -05:00
Jeff Arnold 4feae6b202 Make the back button work for the settings and subscriptions pages
(imported from commit 650c884abc9514cdfc934ae01e0a490f5f681292)
2012-12-20 14:45:11 -05:00
Jeff Arnold f4ddf4412b Make it possible to paste a #narrow URL into a new tab
(imported from commit 0a2ac3e7100627fd02874b02c1b5abe6d4b58c77)
2012-12-20 14:45:11 -05:00
Tyler Hallada d179de07f6 Clear the composebox on open instead of close
Variables like stream, subject, and message were getting cleared from the DOM
when the compose box was closed. The "Create and send" button was trying to
access these variables to create a new stream, but they were gone. Now they
are cleared when a new compose is started.

Fixes trac ticket #568.

(imported from commit 39ccaaeacb3f92f4b1d771be1b34ff660e0d5883)
2012-12-19 15:07:04 -05:00
Jeff Arnold db6f03d46d Make the back button work when narrowed
(imported from commit be922b06e7b53ec21751e67a490bb518333c3e6c)
2012-12-19 14:46:31 -05:00
Zev Benjamin a92a35906c Reset favicon after setting window.location.hash
Firefox drops the favicon after modifying window.location.hash, so we
reset it after modifying it.  See
https://bugzilla.mozilla.org/show_bug.cgi?id=408415 and
https://bugzilla.mozilla.org/show_bug.cgi?id=519028

This fixes #422

(imported from commit 3d7ac5ba28a4fa94d2bd9a0f711db8cd538039d3)
2012-12-17 20:55:47 -05:00
Zev Benjamin 989cee3194 Only set the hash portion of the URL for future-proofing
(imported from commit b860e6c5dde0a75c54678d6a6798611497c1db39)
2012-12-17 20:54:32 -05:00
Tim Abbott 0dda71fb54 Fix website improperly submitting a last value of -1.
We were submitting a 'last' value of -1 to the server at startup,
which is invalid but normally ended up being OK because the user
usually had no messages whatsoever or had last be updated via
get_old_messages before the get_updates call went through.

(imported from commit df55ac1cdac443721c06ebed94a1c4b3ec7af2d1)
2012-12-14 17:15:32 -05:00
Keegan McAllister 197d0dcc01 Revert "Pause for 25 ms in between successful get_updates calls"
This was not totally effective, and with the previous commit it is no longer
needed.

This reverts commit e86c0b653669cf86b0d8956c2c85eb7610fc342f.

(imported from commit 0de5bfec87147b1336f6f79c33d4e32493e1e508)
2012-12-14 16:22:42 -05:00
Keegan McAllister 44b9925bfc Configure get_updates timeout in settings.py
(imported from commit 2a647bdd73c43ca5fed704925808efafc70da044)
2012-12-14 16:22:42 -05:00
Waseem Daher 7de057dcb0 Remove unescaped use of stream name in subscriptions page.
This was causing issues with our ability to unsubscribe from
streams with " in their names.

The solution here is a bit hacky, since it depends on the JavaScript
being fairly aware of the layout of the DOM, which is not great.
But it works.

This fixes Trac #328.

(imported from commit a1b6c8e1f3a9daacdc48920a195717aa89b3a9a9)
2012-12-13 15:46:30 -05:00
Waseem Daher 858d638960 Make subscriptions page slightly more robust to weird characters.
This fixes Trac #522, which previously prevented you from
subscribing to a stream named
    '"]'); alert('hi');

This does not fix #328, which is that you can't unsubscribe
from 'Waseem', among other things.

(imported from commit 869063cafa9e7e988aea993d072ca1ad880bcee1)
2012-12-13 15:46:30 -05:00
Waseem Daher 622bcb9ef4 Call the colorpicker drawing code just once, rather than in a tight loop.
Unfortunately, this doesn't actually give us much performance gain
either; it's not really the calls to 'find' that are taking any time.
But I do find this a little cleaner as well.

Simply initializing 100 colorpickers with our options takes about 700ms.
Initializing ~100 colorpickers with the total default set of options
shaves that down to about 300-400ms (though obviously doesn't quite
achieve what we want).

(imported from commit 7084b35fb6e77600edfcdcfcc2761a11e6f38c03)
2012-12-13 15:46:30 -05:00
Waseem Daher cd237c3429 Smarter template invocation on settings page.
Rather than calling the template generating code once per
subscription, let's just do it in a batch when possible.

With about 100 subscriptions, the "fetch" call takes about 800ms to
render (while testing locally) both before and after this change,
which is somewhat disappointing.

But this *is* cleaner!

(imported from commit 9ba8819524da86c00a2508349be0ea0ddd48606b)
2012-12-13 15:46:30 -05:00
Zev Benjamin 695d9a4dc6 Change get_updates_params.reload_pending to reload.is_pending() as the former no longer exists
(imported from commit fdc59a27230cb49adee2f5444e440aaa84103e5e)
2012-12-11 16:40:26 -05:00
Waseem Daher 4bb330bb21 Allow 'Esc' to clear a keyboard-driven Find.
(imported from commit d48028531b6e7286d177790ec5adb2e5f256b1e0)
2012-12-07 15:01:20 -05:00
Waseem Daher 64b3f072fe Restore "Enter advances find" behavior.
This fixes https://trac.humbughq.com/ticket/546.

It's a little unpleasant that this special-casing lives in hotkey.js
-- instead you could imagine doing something where there was a whole
special set of hotkeys when a search is active, like we do with the
composebox, but this gets the job and is probably simplest.

I would have written this as a case that just falls through in the
else condition, but jslint doesn't like that.

(imported from commit 65a1b8aa1efc356b6690dc177058a4fb9e12745a)
2012-12-07 15:01:20 -05:00
Jeff Arnold d67e2cc4f3 Put the domain earlier in the titlebar, to help distinguish tabs
(imported from commit 225072a7cc044b011114a8630b02d74640b39d55)
2012-12-05 16:03:02 -05:00
Tim Abbott 72b9f25cbd Don't try to scroll to show composebox when no messages are showing.
(imported from commit 3835c7de0f3cad777b1fd5b609e9dc71635422ac)
2012-12-05 14:06:57 -05:00
Keegan McAllister fb77bdf359 bugdown: Set link target, title attributes on the server
For consistency.  Fixes #266.

(imported from commit 63e199a0fe4534df804a82cc98a1fdcf8ccb45da)
2012-12-05 13:54:43 -05:00
Jeff Arnold 8d4ddeb57d Keep text in the compose box when another stream/subj is clicked on
(imported from commit f063c92c4378074a7b27e45787dd1591fdde98b7)
2012-12-05 13:12:52 -05:00
Waseem Daher f3ba899fe1 Fix responsive layout on Subscriptions and Settings page.
This was a really cute bug where our layout messes up if you resize
the page while "Subscriptions" (or to a less visible extent,
"Settings") is active.

The problem here is that we compute the size of the top navbar
based on the size of main_div -- but when main_div is hidden,
it has a width of zero!

We need to instead look at the width of the pane that *is* active.

Resolves https://trac.humbughq.com/ticket/216

(imported from commit adbef00d190845f90c5cfdb46df4ec7b703635ef)
2012-12-04 23:00:06 -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
Waseem Daher af401fe659 Fix "resizing window breaks in Chrome" issue.
Ironically, I think this might've bee introduced by
commit ca35321c02d5e79e4f9c439a662805c016a333ed,
'Fix "resizing window breaks in Firefox" issue'.

Basically, when the window is 776px wide according to
window.innerWidth, that's the width not including the
scrollbar. However, in Chrome, the media query seems to ignore the
width of the scrollbar, so from the CSS's perspective, the window is
actually ~766px wide, so it goes into condensed mode.

But the rest of our code doesn't, which causes the break.

A bit more on this browser-specific difference at:
http://www.456bereastreet.com/archive/201101/media_queries_viewport_width_scrollbars_and_webkit_browsers/

So the issue we have is, to match the CSS's behavior:
* In Firefox, we should be listening to window.innerWidth
* In Chrome, we should be listening to window.width

We fix this hopefully once and for all by using window.matchMedia --
aka the exact same query that the CSS itself uses. As discussed in my
last commit, this feature is unavailable in IE<10, so we provide a
potentially more fragile fallback, i.e. what we did before this
commit.

(imported from commit d8e6425b81c90c8e0fdda28e7273988c9bfd67ec)
2012-12-04 14:52:29 -05:00
Tim Abbott 386e9eeb22 Fix load_old_messages being called with NaN argument.
(imported from commit 32cb17c98b81a40861f3d825e17a687575f35542)
2012-12-04 14:13:04 -05:00
Keegan McAllister 7907be735e hotkey: Make Enter an alias for 'r'
(imported from commit 9bf1b97304a4a4c1100826fefbba8edf1e4cff12)
2012-12-04 10:52:44 -05:00
Jeff Arnold f014163aed When narrowed, we want to load messages older than the oldest message
in the narrowed view, not messages older than the oldest message in
the home view

Tim provided most of the code for this patch

(imported from commit ec0bbfd344cac351f56a456fc560848603721135)
2012-12-03 15:58:26 -05:00
Keegan McAllister f61c26c361 preventDefault for modal mousewheel events but not e.g. subscriptions tab
Fixes mousewheel scrolling on the subscriptions tab.

(imported from commit 38d214fd53a478f3076dbfa4d7942ff13ec61369)
2012-12-03 15:35:46 -05:00
Keegan McAllister 2401fab25c Replace home_tab_active with home_tab_obscured
(imported from commit fb8c47079e63594a22c3d47fcf373887bda6e499)
2012-12-03 15:35:46 -05:00
Jessica McKellar 2fd3eb521c Refactor colorizing requests into a subscription properties model.
(imported from commit da4bfee4a12e941d4ec4c9f140973bb138c82c93)
2012-12-03 12:46:27 -05:00
Jessica McKellar 6a316daee8 Add frontend support for colorizing streams.
(imported from commit 48395ba915d6b22d8a7a8c7fbfb5e462680cef09)
2012-12-03 12:46:27 -05:00
Waseem Daher f71affdc11 Layout for colorizing streams.
(imported from commit 50d359ed44f46a0c666778bf510dafbb3e6e6f97)
2012-12-03 12:46:26 -05:00
Zev Benjamin c5bf05ad0a Make clicking on 'Find <search term>' work
(imported from commit 756bd6cb3533e985e031954ece9228a146c5160e)
2012-11-30 17:03:52 -05:00
Zev Benjamin 0af3199d7c Desynchronize web client reloads
(imported from commit 216df5996f597ccd47bbc80e3f2fdaae751789d0)
2012-11-30 15:04:46 -05:00
Zev Benjamin 46f4a5eb38 Add util module
(imported from commit 3844e136fb799c6f57f8823255addf00a07ef686)
2012-11-30 15:04:46 -05:00
Zev Benjamin d29c77b14c Name unconditional reload time constant and appropriately move its use
(imported from commit 5ead2dbe0f170f8b93e726de6d6ed10a985882ab)
2012-11-30 15:03:19 -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
Keegan McAllister 83660d7020 mousewheel: Explain why the home_tab_active() check is outside throttled_mousewheelhandler
(imported from commit 6fd5504fb5fb0e72426fa60e051b7e912696b8c2)
2012-11-30 13:58:04 -05:00
Keegan McAllister 3ce4427614 ui.js: Whitespace fixes
(imported from commit d7bb9fe17e319f60f1cc65bdfd381dc2f5d25a3a)
2012-11-30 13:01:02 -05:00
Keegan McAllister ee17165ad5 ui.js: Simplify event setup
(imported from commit 96444a0776e6408eb7e885a630855a0f33e0b6ff)
2012-11-30 13:01:02 -05:00
Keegan McAllister 45e515cc20 Handle mousewheel events properly in modals, different tabs, and compose box
Fixes #109.

(imported from commit ebcc90deeba712296998bfaa2df46ec6be305219)
2012-11-30 13:01:01 -05:00
Keegan McAllister 11487a0fd8 Ignore hotkeys when a modal pop-up is visible
Fixes #382.

(imported from commit 50162fde211a88de5e7f410fd7b1ed0df12d6082)
2012-11-29 19:28:59 -05:00
Keegan McAllister c25d1ea8e7 Guard against incorrect use of compose.set_mode
(imported from commit 294441f2b9107ce2488866764c3d30c35133a14a)
2012-11-29 16:51:32 -05:00
Keegan McAllister 1047bf49b4 Replace compose.toggle_mode with compose.set_mode
This fixes a bug where you could click on the already-selected mode button, and
it would switch modes without changing which button is selected.

(imported from commit 263ee0b52ba844c52a3a60968bb1bbff73482412)
2012-11-29 16:51:32 -05:00
Keegan McAllister d55ccd32af Remove state machine code from hotkey.js
With the removal of process_compose_hotkey, the state machine now has only one
state.  Everything else is based on things like "is a text box focused right
now", which is probably a better approach.

(imported from commit 0e39c03956d28e30d2bdbf3b285410ad0cacca3e)
2012-11-29 16:51:32 -05:00
Keegan McAllister 093c65fed2 Remove Tab hotkey to switch compose mode
Resolves #461.

(imported from commit 1ee64f0d6ca05064041e6619e8dbf1dc516c2c13)
2012-11-29 16:51:32 -05:00
Jeff Arnold 4c4e153ace When load_old_messages restarts itself, we need to repass all arguments
Fixes a bug introduced by e30e02c2

(imported from commit ca07eab76295ab1557f6866cff19debaec26e8c2)
2012-11-29 16:08:57 -05:00
Jeff Arnold 6670cf7b55 The load old messages "button" is now gone.
load_old_messages cares whether it is acting on behalf of a narrow
(for_narrow) not whether it is acting on behalf of a button push.

(imported from commit 16c00e015478f94f0631e211a92a7066a38135a8)
2012-11-29 14:18:38 -05:00
Jeff Arnold 50de4db2de Show the loading spinner when automatically loading more messages
(imported from commit 8025dde8696378bbb40b23a14204bfb489eb6798)
2012-11-29 14:18:38 -05:00
Waseem Daher fcc2fd5cdc Add ability to show/hide a "load more messages" spinner.
(imported from commit 611e53b2574ef50c9ab0a47fc2ebedd931a49dfd)
2012-11-29 14:18:38 -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
Tim Abbott 44235e8e7e Fix last_message_id computation catching the dummy row hack.
This was causing glitching where if you narrow so that zfilt has only
one message, and add messages on top (e.g. via get_old_messages), and
then add messages on bottom (e.g. by receiving one), we end up with
the bookend row missing.  One can make this happen with narrowing,
but, this situation happens every time with time travelling.

(imported from commit 71d85980d8aa9431a17b33e9e5111fd3f76cecf3)
2012-11-28 22:26:31 -05:00
Tim Abbott a44c3ff247 get_updates: Eliminate the reload_pending parameter.
(imported from commit c7b57c4ef7fc4d6f0028f174f33ff7ff063d4b9d)
2012-11-28 17:41:38 -05:00
Tim Abbott 55181621bc Send a nonblocking get_updates request on wake-from-sleep.
(imported from commit 91c53f4294a609b1942c6753e9fba4fc4cb2f20f)
2012-11-28 17:41:38 -05:00
Tim Abbott d23a83ee81 get_updates: Replace "failures" with the new dont_block option.
(imported from commit 2b4ecb35c4f14b6c408323662ef6f39c6485c62d)
2012-11-28 17:41:38 -05:00
Keegan McAllister 0f1be6a9f6 rows: Consistently return an empty jQuery object in some corner cases
(imported from commit 4a83c8a3671fe13c8ff7c55fa2e22221bd68b21e)
2012-11-28 17:15:25 -05:00
Keegan McAllister 83216a5965 Ensure initial state satisfies selected_message == rows.get(selected_message_id)
If the message doesn't exist, rows.get returns an empty jQuery object, not
'undefined'.

(imported from commit 40620f3e4853a662cb93939bf7f0695f81298777)
2012-11-28 17:15:25 -05:00
Zev Benjamin faf426baa7 Only send pointer updates when user has been idle for a short period
This is so we only send a single pointer update when the user scrolls
through a bunch of messages at once.

(imported from commit 20d239d7179e5f57ada99968361a0f9b7b18c591)
2012-11-28 16:36:43 -05:00
Zev Benjamin 48790187ca select_message_id: Remove no longer applicable update_server option
(imported from commit 03076f1d514017b70ec5bd2b34b1a575d0c56f6e)
2012-11-28 16:36:43 -05:00
Zev Benjamin 249b7a527f Switch to high-watermark pointer model
(imported from commit c05d074a404e823eaa0808b6938a3c80e457175b)
2012-11-28 16:36:41 -05:00
Zev Benjamin fbe41c95d5 Re-enable pointer sync
(imported from commit 9f765bbc32e6a3fd91e83aa4016c8e8f8c47bfc1)
2012-11-28 16:36:24 -05:00
Jeff Arnold ed1eff9bfa Dismiss all notifications when the tab regains focus
(imported from commit 53c807d7a02aabe62a832a129505d690e98e39cc)
2012-11-27 13:39:46 -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
Waseem Daher 60789abd7f Consistently use 'exports' rather than 'typeahead_helper'.
(imported from commit 6106f0ed2708f710a9e3f589560fda58999caa71)
2012-11-27 13:29:26 -05:00
Waseem Daher 2321059240 Don't highlight, e.g. 'Narrow to', in the searchbox typeahead.
(imported from commit f16f1417da708ad2060ba603fe14ea113559d100)
2012-11-27 13:28:21 -05:00
Waseem Daher e0f3c43432 Deduplicate code a little.
(imported from commit 52c32776641256fc145ce1ff7a60ca8fb92ea784)
2012-11-27 13:28:21 -05:00
Waseem Daher 8c0445bff5 Sort searchbox typeahead in a more intelligent way.
Ensure that every result has one of:
* find what you typed in
* search for what you typed in
* Narrow to a stream related to what you typed
* Narrow to a person related to what you type

(imported from commit 2178f17932f951a48f53d982ef660942562b55dc)
2012-11-27 13:28:21 -05:00
Waseem Daher ab8496b9ba Sort streams and subjects in a better way.
Modify the Bootstrap default sorter to sort by:
1. Starts-with, in a case-sensitive way
2. Starts-with, in a case-insensitive way
3. Matches anywhere, case-sensitive
4. Matches anywhere, case-insensitive

(This fixes the Keegan-reported issue of "Testing!" taking precedence
over "test" when he types in "tes")

(imported from commit b2a0127956fe7a8bf1cbf30752a6ddc2c49b7198)
2012-11-27 13:28:21 -05:00
Waseem Daher 830f9df3f2 Keep typeahead initialization together.
(imported from commit d4035e97a223dc05d5f2d85f0577724fc5067577)
2012-11-27 13:28:21 -05:00
Waseem Daher 660c7437ba Move code from composebox_typeahead to typeahead_helper.
(But don't actually make it work yet -- that's for the next commit.
This makes the diff a bit easier to review, since it's really just
code moving from composebox_typeahead to typeahead_helper, and the
appropriate changes in zephyr.js, rather than code moving AND
changing)

(imported from commit 5cb2e836eeb8807f4eb98424558702d44a0e2b70)
2012-11-27 13:28:21 -05:00
Zev Benjamin 9de11f4df1 Use jQuery.one() instead of binding and unbinding a handler
(imported from commit 23b87ee500c0739b04e6fa3c89065d4af13ab9b5)
2012-11-26 16:49:11 -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
Zev Benjamin d8783cd0c0 Move reload in progress check from compose.show to compose.start
(imported from commit 8b84b24ca50a3bd149d67b868dd94908c0354022)
2012-11-26 14:42:27 -05:00
Zev Benjamin 85e2bf9030 Remove dead code. We keep the message type and client name in JS instead of the DOM now
(imported from commit 79834160c53a5f7d99918d629fde311aa99fe280)
2012-11-26 14:42:27 -05:00
Zev Benjamin 507a730f77 Make compose.show a private function
(imported from commit 32457fd7f045e9eb3febaed3de2dd1a4aebc9422)
2012-11-26 14:42:27 -05:00
Zev Benjamin 40b31f6f57 Remove dead code
(imported from commit 3893b95cc3c26596d580ea07286955c2ab19cddd)
2012-11-26 14:42:27 -05:00
Zev Benjamin e35ec6e022 Stop using Bootstrap tabs for compose
(imported from commit 39dfbf9c427aaf3a85507e26ffeb1257da3dc435)
2012-11-26 14:42:27 -05:00
Zev Benjamin 886bda2a45 Use accessors in compose.start
(imported from commit 82cc5dd5892b06a8490fcd40033212f28dca32b3)
2012-11-26 14:42:27 -05:00
Zev Benjamin 8367cec454 Fix indentation
(imported from commit 4735fd730eb74cff8d494fc3d440111733af505f)
2012-11-26 14:42:27 -05:00
Waseem Daher 6d2b2f897a Implement safari composebox workaround in a less fragile way.
If Javascript breaks or stops working, the previous hack means that
Tab-Enter stops working on Firefox and Chrome (since the tab key now
needs to select two divs before it gets to the Send button.)

By putting the one div *after* the Send button, we ensure that this
keeps working gracefully on Firefox and Chrome (and presumably IE), at
the expense of Safari in this specific case.

(imported from commit 9c9a613b1b1718ff8f0b9ef7497ebb13db0ddc64)
2012-11-26 12:15:14 -05:00
Tim Abbott fac24df233 Show a user-visible error message when mirroring is not working.
The main problem with this code is that the error message doesn't go
away until you reload.  To fix this, we need to add a noblock option
on get_updates.

(imported from commit dc45af397bcf06a218bda5dd224ebd5fdf3462db)
2012-11-26 11:49:29 -05:00
Tim Abbott eefa5b2d7b API: Add support for nonblocking get_updates requests.
(imported from commit bf2ab19a83765c177fbb93abc1a61dccf5b4b2b7)
2012-11-26 11:49:29 -05:00
Keegan McAllister 384a50822d Avoid unnecessary rows.get in pointer management
(imported from commit ef1d8a885b264be797616a2bab3f23e2702949c5)
2012-11-25 15:21:55 -05:00
Keegan McAllister a70fb98038 Reduce code duplication in keep_pointer_in_view
Fixes #269.

(imported from commit 5d382c0e1493a0798fc9bd1f5a8f37e15f2ea5ef)
2012-11-24 02:03:17 -05:00
Zev Benjamin f1e644ece8 Fix "multiple popovers can appear" issue.
The reproducer for the issue here is:
- Scroll to the top of your feed
- Click on a stream name
- Open a popover
- Click on a subject name
- Note that your old popover doesn't go away, and that you can open
  a new one.

The problem was that when we narrow, we call jQuery.empty() on the
zfilt table. That not only removes nodes but also clears event
handlers and jquery data. Thus, even though we have a reference to
the old popover element in the ui module, the element has forgotten
it had a popover. When we call .popover("destroy") it actually
creates a new popover, but never shows it.

(imported from commit 9721d60c78549bd2362833590b304952f2bdef2d)
2012-11-21 18:02:33 -05:00
Jessica McKellar 3b4df3bbad Refactor replace_floating_recipient_bar to reduce code duplication.
(imported from commit 9f044a370e4b57c12eaca667e7d0ccdf9f546628)
2012-11-21 16:44:04 -05:00
Jessica McKellar 89582bff8a Fix floating recipient bar being unnarrowable.
When we switched to delegated event handling, the bound handler for
all of our events was #main_div, but the floating recipient bar lives
outside of #main_div. Additionally, the bar needs to inherit the zid
from the target recipient bar since it is used for the narrow.

(imported from commit 7c18e16f2e98436888a8edb81fbbdd4d17abfe2a)
2012-11-21 16:44:03 -05:00
Zev Benjamin f77b138bc4 Fix left border appearing on messages in Firefox
The problem seems to be caused by a bug in Firefox.  We work around
the issue by adding empty table rows to the top of the table and
removing them when the user is idle.

This resolves trac #413

(imported from commit 2b15a4a2241bd7e813800a42608d650e0d4fa4f0)
2012-11-21 12:18:04 -05:00
Waseem Daher 776a947f75 Properly handle a "top" update in an empty narrow.
Previously, it was impossible to narrow to a completely empty narrow.
Now it is possible, and the code needs to be tweaked in a few ways
not to break in this case.

(imported from commit e4dd4159ad52d003fc11d0b8b6531322c12a3de8)
2012-11-21 10:38:31 -05:00
Keegan McAllister ced6921491 Redirect to /accounts/login if an Ajax call fails because we aren't logged in
Fixes #396.

We could display an error message, but jumping right to the login page seems
smoother and conveys the same information.

This will discard any message being composed, but preserving it would have
security consequences that we should consider further before implementing that.
Hopefully, users only get logged out by an explicit action, so they can't
complain too much (but see #217).

(imported from commit aaa23ecf46c73e514117ae1010fc44e133f2ba07)
2012-11-20 21:49:11 -05:00
Tim Abbott 15c778dacf style: Use space before "(" when defining an anonymous function.
(imported from commit 369e13d918f0da2566587b83f3881c908a152519)
2012-11-20 17:17:39 -05:00
Tim Abbott 14494d6a1f Add "time travel" feature.
(imported from commit b7b6794ad635ec63269a2043cd48b02749fbffda)
2012-11-20 17:17:39 -05:00
Tim Abbott bbf482b6f8 Fix using "load old messages" on the narrowed view after unnarrowing.
Previously, we were adding those narrowed messages to message_dict the
first time, and thus totally skipping those messages each additional
time you tried to "load old messages" on that narrow.

(imported from commit 77eef376e1165b86e3c599608a1b5089a09d51e0)
2012-11-20 17:17:39 -05:00
Tim Abbott 2b7ecfd325 get_old_messages: support adding messages on both top and bottom.
(imported from commit f01ca9f9770d07fb736f07b4c2397efe71ee8d1e)
2012-11-20 17:17:39 -05:00
Tim Abbott da43f250a4 narrow: Fix incorrectly adding messages to message_array.
(imported from commit babc7f40e0817c29e7d55f3ba534cbf3de8e3920)
2012-11-20 17:17:39 -05:00
Jessica McKellar cb50d4e7ef Have smarter PM autocomplete: sort based on who you Humbug the most.
(imported from commit 8b0223c97bc2cb8a1470ca482831ca615aaf10ec)
2012-11-20 15:08:49 -05:00
Zev Benjamin dbb0241568 add_to_table: bail early if there are no messages to render
This bug affected receiving messages while narrowed.  When none of
the messages recieved matched the narrow predicate, we'd try to
render messages and then create a jQuery object out of a bunch of
newlines (the only thing that results from a render of 0 messages).

(imported from commit 81f5aa46fac06fe0e5a14a8757f245f90b5845cc)
2012-11-20 14:06:36 -05:00
Jeff Arnold 57fbf21a7a Make searches with no initial results still work
(imported from commit 3dde5d661521001373430c1413ac1f80a16a1c2d)
2012-11-20 10:31:28 -05:00
Zev Benjamin 359fb41b64 Manipulate messages before adding them to the DOM
This greatly reduces the number of events generated and prevents the
blue flashing on message arrival.

This also necessitated a change in how we looked up message rows to
add the 'next_is_same_sender' class, which led to a further
optimization where we don't have to do as many jQuery selections by
id.

(imported from commit 0bcd5688b483c560b6f3a29c6d36433da600e8ef)
2012-11-19 23:31:23 -05:00
Zev Benjamin 39aab741c8 When hiding the sender email address, only hide the element that was previously shown
(imported from commit 527f58aff4f2ec65d7ffe693bc20298b4563ff4e)
2012-11-19 23:31:22 -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
Zev Benjamin a5ea766ff6 Use delegated event handlers instead of inline, direct handlers on messages
(imported from commit dd7dc77e8282371a5f3b82e0cfa93f09d53a7a80)
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 53f5480fc4 Don't recompute search typeahead source every time.
(imported from commit 8e7ffa76ec701519704280caa282eb4639998a42)
2012-11-18 19:41:04 -05:00
Waseem Daher 57d35649f3 Move update_autocomplete into typeahead_helper.
(imported from commit e15446e09869da482dbe554b824ea8bb6f060cf1)
2012-11-18 19:41:04 -05:00
Waseem Daher f9130369f2 Rewrite private_message_typeahead so it has access to the people_list objects.
(imported from commit 3772fb2db9db96947555d30ad923edbde3127b3f)
2012-11-18 19:41:04 -05:00
Waseem Daher 31c4cf96d2 typeahead_helper: Add escaping highlighter.
(imported from commit 71c08479763da792b581ff191c04889f0383ccc9)
2012-11-18 19:41:04 -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 2287c553ec If we just narrowed from a search, blur the searchbox so that Esc still works.
(imported from commit e8bfe58b81a12bb6dba34ab5210c249a33b5c700)
2012-11-18 19:39:49 -05:00
Waseem Daher afa7e83414 Make the searchbox typeahead optionally narrow to stream or PMs.
(imported from commit dcef6f4d426a37c010363cc943441bd0361f8f05)
2012-11-18 19:39:44 -05:00
Waseem Daher 95706ce9a2 Create a searchbox typeahead where enter does not submit the form.
(imported from commit 38105e2f31611dda8c9767212f18c1a73640df45)
2012-11-17 23:58:16 -05:00
Waseem Daher ab78076c43 composebox_typeahead.js: Export code that splits name-and-email.
(imported from commit b118a9b0475b71cb4ffd880bcde5868d4e81e73e)
2012-11-17 23:29:35 -05:00
Tim Abbott d1239278c7 Rewrite remove_subscriptions to work like add_subscriptions.
In particular:
* Taking a list of streams as arguments.
* Using the _backend model so that we can have an API version.
* Considering "not subscribed" to be a non-fatal error.

And of course the corresponding changes to subs.js.

(imported from commit fdb300c6aa6921c2c6b09c22bd1e64405c368809)
2012-11-16 17:06:01 -05:00
Tim Abbott f5ccde78e3 [manual] Use "subscriptions" for {add,list}_subscriptions consistently.
This change requires a zephyr_mirror deployment when it is pushed to prod.

(imported from commit a31d6efd2db4d4617c7c6b00326be3f07c7263da)
2012-11-16 17:06:01 -05:00
Waseem Daher b251d064f9 narrow.js: Add ability to narrow to private messages by name/email.
(imported from commit b3afda6444afa9b44b140882f3d71fb41b3ef10d)
2012-11-16 15:58:49 -05:00
Waseem Daher 77a45cbc0e narrow.js: Add the ability to narrow by stream name.
(imported from commit 033dea1f63cceb30f37eae50ea3a7425a8e94685)
2012-11-16 15:58:37 -05:00
Waseem Daher 79abd7cb5c Make searchbox shrinking idempotent.
The existing code shortens the searchbox each time it receives focus.
Unfortunately, this means that if it receives focus twice in a row, it
shrinks twice in a row. (For some reason, the '/' hotkey does this).

So, instead, make it idempotent -- if we're already shrunk, don't
shrink us again.

(imported from commit 8179963bbd00822d15d92609d89f572d2de7800c)
2012-11-15 22:13:52 -05:00
Waseem Daher 5fa0b8d9d0 Allow searchbox to grow and shrink more flexibly.
This is nearly perfect, modulo two things:

1. If you have a search active and you resize the window, the search
   box resize doesn't take effect until you exit the search.

2. In super-narrow windows (<380px), the searchbox overshoots
   the message area slightly.

I don't regard either as huge issues -- I'll probably fix #1
eventually.

(imported from commit 4900fb9783cc9f447315b0892bd3505f5c31ce15)
2012-11-15 17:23:00 -05:00
Tim Abbott 50995dc6b7 Fix showing the subscribe-and-send dialogue when you're subscribed.
This doesn't fully fix the problems related to not syncing
subscriptions to browser clients, but it does fix the instance that
everyone experiences.

(imported from commit be2bc31a7c4443c1678321f1a938496e2632c0d3)
2012-11-15 17:15:59 -05:00
Jeff Arnold a68efd9ce2 Handle loading of older messages in narrowed view
(imported from commit 2fe1377736322a44e8682c69dd5e4312d5f46ca4)
2012-11-15 16:32:00 -05:00
Tim Abbott 411a7f6b4f [manual] send_message: Rename recipient/stream fields to 'to'.
This commit changes APIs and requires and update of all zephyr
mirroring bots to deploy properly.

(imported from commit 2672d2d07269379f7a865644aaeb6796d54183e1)
2012-11-15 15:30:06 -05:00
Waseem Daher 834c812a14 Rename "send_message" to "send_message_form" for clarity.
(imported from commit 25d9bde3390e47390724a8d4b3fd1fe95b44bd71)
2012-11-14 16:19:56 -05:00
Waseem Daher 3cf29025ec Prevent composebox form-handling code from running on all forms.
(imported from commit aee10dac671b1da83295d9e197eec4d3a0a7ceeb)
2012-11-14 16:14:48 -05:00
Waseem Daher b7a9e17b67 Rename 'search' input element to 'search_query'.
If we don't do this, we get all kinds of nasty shadowing where
references to 'search.whatever' seem to be references to the
HTML input element, rather than our search.js module.

(imported from commit 4e4b562ddf895baea9619316d9fab27ae5e9fc4e)
2012-11-14 15:29:18 -05:00
Waseem Daher a1c4aa6865 Modularize search.js.
(imported from commit 72f00f832846124d833071fdd46b026c99189512)
2012-11-14 15:29:18 -05:00
Keegan McAllister ce49595a00 reload: Remove dead variable
(imported from commit d3ec0d7c422990606817efcc47e7eb18c221ca25)
2012-11-14 14:18:05 -05:00
Keegan McAllister 6f2bbe5917 Set and check csrf_token for #reload
Fixes a message forgery bug (#335).

This works because Django will not generate a new CSRF token if a valid token
cookie is already present (see django/middleware/csrf.py).

(imported from commit 23222cb0bb62ae8a2f8ac7fb3f24bbc866103454)
2012-11-14 13:35:24 -05:00
Keegan McAllister 122281553a Make csrf_token global
(imported from commit 734d9c886c3a77d2ba40bd449cb089a00807a656)
2012-11-14 13:35:24 -05:00
Zev Benjamin 585210feaa Fix the "load more" button disappearing after the first time it's clicked
I think this broke during a rebase.

(imported from commit 1b8d28b72127b47fbca7d4c44bab77bec1e3d053)
2012-11-14 13:01:28 -05:00
Jeff Arnold d473292f5c Make enter not submit the form in private message compose box
Fixes regression introduced by 97a438

(imported from commit 2da31fb7a742a317c9d6839ef7a1a5f887746dd3)
2012-11-14 10:27:52 -05:00
Jeff Arnold db34090f1f Now that we have proper escape support, tab can autocomplete
(imported from commit 28faff5416301dbc168e6ffcd0045df582961c9d)
2012-11-13 16:15:43 -05:00
Jeff Arnold 1d818db995 Make escape close just the open typeahead on Firefox, not the compose
(imported from commit 59dc10dbf9deb1b42240ae534da4ccc1ec2ef7df)
2012-11-13 16:15:43 -05:00
Zev Benjamin bb534f7a5f Missed a usage of the old get_old_messages API
(imported from commit 15d3e4bb40f9aa64e976de636a5bef6e694e00c9)
2012-11-13 16:06:46 -05:00
Zev Benjamin 195bdb07c9 Unify huddles and personals into private messages on the send path
Personals are now just private messages between two people (which
sometimes manifests as a private message with one recipient).  The
new message type on the send path is 'private'.  Note that the receive
path still has 'personal' and 'huddle' message types.

(imported from commit 97a438ef5c0b3db4eb3e6db674ea38a081265dd3)
2012-11-13 15:40:53 -05:00
Zev Benjamin 0c1cccc880 Use plain $.ajax instead of jquery.form for sending messages
(imported from commit 46651224dfb0b1b3b4903b30cba5385025da173c)
2012-11-13 15:40:53 -05:00
Zev Benjamin 33c23c0113 Use a JSON array for recipients in send_message
(imported from commit e2184f92b708cc2e8ef3e9ae79ee4241c0aa12a1)
2012-11-13 15:40:53 -05:00
Zev Benjamin b948473a45 Simplify get_old_messages API
It now takes an anchor message id, a number of messages before, and a
number of messages after.  The result always contains the anchor
message.

(imported from commit 84d070dc8091161c86d4bbeafbdc299493890a2a)
2012-11-13 15:40:53 -05:00
Waseem Daher c8e87e0e6a Unbreak ctrl-click and shift-click in Firefox.
We had this problem where clicking a hyperlink bubbles up and causes a
click on the message, which causes the composebox to open.

We "fixed" this by setting cancelBubble (or, even better, calling
stopPropagation()).

Unfortunately, on Firefox, this fix breaks Ctrl-click and Shift-click,
because those are (apparently) implemented by adding an event listener
on link clicks, and stopPropagation prevents them from being called.

We instead work around this by handling this case in the click handler
of the parent element. (This allows the normal URL click AND Firefox's
bound event handlers for Ctrl and Shift to run.)

This resolves Trac #374.

(imported from commit 16fb3aa6fc582f1fba5009812e0b1178ce7c5bb7)
2012-11-13 13:44:31 -05:00
Keegan McAllister 9bbe12c6cd Pause for 25 ms in between successful get_updates calls
(imported from commit e86c0b653669cf86b0d8956c2c85eb7610fc342f)
2012-11-13 10:59:02 -05:00
Jeff Arnold 488370b681 Fix various compose box bugs involving typeahead and field navigation
(imported from commit 08fe92794d566163bd935d43ec5bd7eb69978f90)
2012-11-12 18:04:31 -05:00
Waseem Daher d7f146ed4f Standardize on 'e', not 'event', within hotkey.js.
Mixing these two in this file is bound to lead to a world of hurt (and
has, historically). At some point I'd like to do this across the
entire codebase.

(imported from commit 9ff029597587f9c37a0bd9f32c25a769aa1a7a20)
2012-11-11 17:56:46 -05:00
Waseem Daher cdb31303fc Remove unused function.
(imported from commit 81ba1f66128f1e7f132ae3e1da3d81ad14d7ebe0)
2012-11-11 17:56:45 -05:00
Waseem Daher c5f3018431 Simplify hotkey handling when combinations are involved.
This makes the "handle hotkeys" code path a lot simpler, and also
fixes the "copy not working" issue we were seeing on Firefox 17.

(imported from commit 8ab96d12895da2876f60da58f373372612f4ba32)
2012-11-11 17:56:41 -05:00
Waseem Daher d76442c7e4 Process the whole key event through the hotkey handler, not just the key code.
(imported from commit c356dd09f7c2620c45d5bada61c0a5b261768888)
2012-11-11 16:35:45 -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
Jeff Arnold e7807742cb Pressing "enter" in the compose box fields should not submit the form
Resolves Trac #333

(imported from commit 2a824c5d38a6b53a425c72f5eb3534fe26d75faf)
2012-11-11 12:28:26 -05:00
Waseem Daher da571f16ff Fix "resizing window breaks in Firefox" issue.
So, in Firefox, $(window).width() does not include the width of the
scrollbar. However, the CSS media-query max-width DOES include the
width of the scrollbar -- so the Bootstrap change and our change do
not happen at the same time.

window.innerWidth does take into account the width of the scrollbar,
though, and seems to have reasonable cross-browser support, so we use
that instead.

(If we wanted to be slicker, we could use a media query a la
https://developer.mozilla.org/en-US/docs/DOM/window.matchMedia ,
but that's not supported in IE <10.)

This resolves Trac #35.

(imported from commit ca35321c02d5e79e4f9c439a662805c016a333ed)
2012-11-10 14:52:53 -05:00
Zev Benjamin c3a17de14c Don't switch to the not-composing state if the server did not accept our message
This fixes #349

(imported from commit 4e54f3ab3e9c91c5f23ccf22269775b01550f757)
2012-11-09 18:08:31 -05:00
Zev Benjamin d41fde7d92 Rename parameter for clarity
(imported from commit c69a5a57467664631ba812c5237641e0203e1aaa)
2012-11-09 18:08:31 -05:00
Zev Benjamin d980afcf25 Actually convert to JSON instead of hacking it with string concatenation
Old browsers might not have the global JSON object, so we may have to
include something like https://github.com/douglascrockford/JSON-js
for old browsers in the future.

(imported from commit e30a291d1212f2a00b543551b3a77082c7406eec)
2012-11-09 18:08:31 -05:00
Jeff Arnold c800186553 Make tab not autocomplete on the compose box subject field
(imported from commit 7b305a3ca5ae5864255c4eca5464560f92b708b0)
2012-11-09 17:57:20 -05:00
Waseem Daher cb0f48b59d Restyle subscriptions 'undo button' slightly.
Some stylistic tweaking to the solution to Trac #127.

(imported from commit 5f9a84c91716e6e57cce2cef1d8ca0915e4b135f)
2012-11-09 17:13:15 -05:00
Luke Faraone ed1caec147 Document the selctors in signup.js per trac #327
(imported from commit b21f5c4dbdc1b4dc5dbdc5a3152fdc8cbbb872ef)
2012-11-09 15:03:08 -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 3df5d0faf3 Don't disable hotkeys on buttons in general -- just the send button.
The original check has become too broad now that we have more buttons,
and specifically this lets you use the search hotkey to start a new
search after you've been searching up and down.

(imported from commit 0e691ff55ff9d4be8d406d1eb47fc2062758d28b)
2012-11-09 11:44:06 -05:00
Luke Faraone 3928f763e9 Make unsubbing an undoable action.
(imported from commit 713fdad5aa5d138b9e95a14dccaeba0d9d612c1c)
2012-11-08 14:42:50 -05:00
Jessica McKellar 1801292320 Update autocomplete lists only on case-insensitive new additions.
That way your autocomplete isn't polluted by multiple casings of the
same subject.

(imported from commit 0f28029be45bb48981f2e29ccb9f1490c1a56c94)
2012-11-07 14:51:51 -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
Keegan McAllister 3b78280786 search_button_handler: Remove unnecessary id lookup
(imported from commit e6da0cfa0b39e48c63464eaf91673c3133ad4cd4)
2012-11-07 11:51:03 -05:00
Keegan McAllister 3de0a0d1dd Use rows.id consistently
(imported from commit 58098986b90609484e4a7c10688eeb27f2c126b2)
2012-11-07 11:51:03 -05:00
Keegan McAllister 644702892b Return an int from rows.id
I believe this is more correct for our one existing user,
update_selected_message.

(imported from commit a2f1a20c0d885a4e6de49c69d930844177549cbe)
2012-11-07 11:51:03 -05:00