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)
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)
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)
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)
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)
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)
This was not totally effective, and with the previous commit it is no longer
needed.
This reverts commit e86c0b653669cf86b0d8956c2c85eb7610fc342f.
(imported from commit 0de5bfec87147b1336f6f79c33d4e32493e1e508)
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)
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)
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)
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)
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)
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)
feedback-bot and zephyr_mirror will need to be updated and restarted
when this is deployed to prod.
(imported from commit fe2b524424c174bcb1b717a851a5d3815fda3f69)
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)
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)
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)
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)
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)
This restores the time-travel functionality and fixes Waseem's laundry
list of problems with its original UI.
(imported from commit e30e02c25af994435adb815d26284b3669c945a4)
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)
If the message doesn't exist, rows.get returns an empty jQuery object, not
'undefined'.
(imported from commit 40620f3e4853a662cb93939bf7f0695f81298777)
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)
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)
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)
(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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
This commit changes APIs and requires and update of all zephyr
mirroring bots to deploy properly.
(imported from commit 2672d2d07269379f7a865644aaeb6796d54183e1)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
From the Google JavaScript Style Guide:
If you need a map/hash use Object instead of Array in these cases because
the features that you want are actually features of Object and not of Array.
Array just happens to extend Object (like any other object in JS and
therefore you might as well have used Date, RegExp or String).
(imported from commit 048e7a640137f3919c0097a421b7b6c366b65cfe)
This clarifies that clicking on any of those three pieces of
information will pop up the user info tooltip.
(imported from commit 1e57550d66acbb2e8d5d244d2997bbd394c334c3)
The comment on keydown_handler says that these functions should
"return a new handler, or 'false' to decline to handle the event."
(imported from commit 8cd23ee69ef900fcb7c7c211fe6ad36f54f02ba9)
This reverts commit 429e055d3eca65af8bc0fe58481a7becf9ced66a.
There is some inconsistency between the names 'huddle' and 'personal' that is
breaking things.
(imported from commit 4c81853fca9d88d13ce8f23e2d6884c33cdc57d2)
This makes the Home link modal (when on the Home pane, it unnarrows
you; when on a different pane, it returns you to your feed in whatever
state you left it).
Fixes Trac #5.
(imported from commit 3181f17035d78a9916ab7a3ad336f34cb66d3cdf)
You're not necessariy getting the last email, you're getting
the last recipient the user typed in.
(imported from commit f7ab4153a5b2497bc31a42d3ac5aea0636daaf60)
This attempts to tackle the issue where Cordelia always gets
accidentally CCd, with the following as a reproducer:
wda [tab] [backspace] [tab or enter] sends a message to wdaher and cordelia
(imported from commit fbbd722173584e50c34878b7d6249b09564fb172)
The fact that we're inconsistent about this in our functions
is definitely going to lead to more bugs of this form
down the road.
(imported from commit 907badcb28c0834729e21436c621255fa6584d44)
We currently disable hotkeys if the focus is on a textbox or
button. Hidden buttons can still be in focus, so blur the search
buttons before hiding them.
(imported from commit 5fdab34ad9931ea5ea2ad1827b36dfe4c02d8797)
Whenever we use a typeahead, we should use the escaping highlighter
unless we're explicitly going to put sanitized content in it.
(imported from commit 33086327fe56a7bcbbbf8a08fe3f39800b195e75)
This also cleans up the autocomplete source specifications,
making the three typeaheads all look fairly consistent.
(imported from commit e72655d715db74cfc9ab45b51e7e2ff9e8ea84c5)
This makes the diff a bit cleaner.
Revert "Interim measure: Escape fullnames as well."
This reverts commit a634e6ac39ea337be499889b3ff64b3c4f4fcccb.
Revert "Interim measure: Escape subject names before they go into the typeahead."
This reverts commit 806bc719ab296ec0fe299b33c7aa6767a0c71b9d.
(imported from commit 5a579e3535846b2bc612cf03e43c562c83119812)
While we're at it, fix the fact that we're currently not adding
entries to the subscriptions_table at all when we do
subscribe-and-send.
(imported from commit 99bf574a4a296463e562a44186e2282654464542)
I'm sure this problem exists in a latent way with stream names and
email addresses as well. Once I figure out a general way to fix this,
I'd like to go back and handle these three cases in a cleaner,
symmetric way, but this'll do for now.
(imported from commit a634e6ac39ea337be499889b3ff64b3c4f4fcccb)
This is problematic because if your subject name is <b>hi</b>,
selecting it from the typeahead comes back with:
<b>hi</b>
which obviously isn't really OK.
(imported from commit 806bc719ab296ec0fe299b33c7aa6767a0c71b9d)
Validation was happening, but was not preventing sending. We now
just manually call the validation function in compose.finish()
instead of relying on jquery.form's beforeSubmit option.
(imported from commit e094832bf8948f4c6f58cc0d0923bf0fd09db4b1)
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)
We weren't listing to compose finish events during reload previously,
which meant that finishing a message was not handled in the same way
as canceling a message.
(imported from commit 4f2576121a8b5354c94348bc2896a2db8c4be000)
This would only happen when you hit enter directly, instead of using
the search up / down buttons.
(imported from commit 90301f64b3f24e91c103342bd6a7f1b3e61f8928)
Per the docs, these are only meant to be used on arrays of DOM elements.
jQuery might one day assign a different meaning to arrays of strings,
and then we could have some security issues or weird breakage.
(imported from commit 545eee1e9c6955556d5c4bda30cd6db0dce19c60)
Instead we infer this from narrow.active(), with the ability to override during
the narrowing procedure.
(imported from commit fab9c6861f19aedf0ee8af094c1ef4e8a0a73d80)
This simplifies the code, and lets us set the CSRF cookie as HttpOnly, which
adds a little bit of security.
(imported from commit 9d5923a1acf19bd27e6e1d55cf627049526de245)
This reverts commit 074011dfe7dfa4d3cb331b32fc6cf465f98d095f. For
some reason this introduces some buggy behavior, and if anything I
should debug it more locally first.
(imported from commit 182193e6bb466a5668c2bb64e41712a793fa7ca2)
This seems more likely to be what people want when e.g. viewing all huddles.
Later we can get more clever and select the nearest huddle, or something.
(imported from commit 8ec1aa02c050dd25eb868b1e317d114743525c7b)
Our old selector here was picking up the floating recipient label, or
something. This was breaking narrow-to-all-huddles when on a stream message --
you get no selection and the code is sad.
(imported from commit d25fab03bd6d745df6d787c0b1b6452c8c539e32)
- s for stream or huddle
- S for subject
- p for all personals (still buggy)
We've eliminated the 'g' prefix entirely. And the old 'g-a' un-narrow sequence
has no new equivalent, but you can still use Esc.
(imported from commit 6bdaacce9639e3f749418e06622a317937e7d014)
Ideally this would be part of hiding zhome, but right now zhome/zfilt are
assumed to the tables themselves, and changing that seems unfortunately
invasive. And it's not crazy to think of the "loading controls" as a logically
separate thing that we might show/hide independently.
Longer term, we may want an indication in narrowed view that there could be
more messages on the server.
(imported from commit eb72d720da7c03f6f1378ae18ab6e973bf98247f)
The server will occationally return successfully with no data during
a restart. Previously, when we would get such responses, the page
would stop working because of JS errors.
(imported from commit 39b89907dc5ae9a9eb54ebf60d0069281e401786)
This fixes a problem where the client would never stop asking for old
messages (bug introduced during rebase)
(imported from commit eef9f19e1e9982b1e0a954eb36a81e1b7ee5b564)
The client may now optionally send its current pointer during
get_updates and the server will return the latest pointer if it
differs and was updated more recently by a different session.
(imported from commit e43b377d7dfb52f83cefb0b1003863d5407caf80)
This was preventing huddles from sending because clients thought they
were still sending a stream message.
(imported from commit 694b06cbc43adc9563327ebffccb7fa37aa36bac)
The flag is set to the kind of message being composed in
start_composing() and set to false in finish_composing().
This avoids the problem where composing_message() will return true
when the animation is still running.
(imported from commit 4c2e7e1fad2e6b2123825bd51d5b24ae41bccd45)
This fixes a bug where the server wasn't returning from get_updates
immediately when the client needed a reload.
(imported from commit 1d854eb1c7061f468d091e103f10074f4c7231d8)