Commit Graph

1877 Commits

Author SHA1 Message Date
Leo Franchi 56af48cd50 Split wildcard mentions from personal mentions, only email on personals
(imported from commit 18971d9e40dd2c93ef9c30edc963da33e3c65309)
2013-05-31 12:24:31 -04:00
Leo Franchi 0524c14c8c Ignore leading spaces in search box
(imported from commit 098a8f288c8264cc804b737f804b866c64c0ff5b)
2013-05-31 12:24:30 -04:00
Jessica McKellar f6be3289c1 tutorial: fix out of date references to message formatting and feedback locations.
(imported from commit 8f5b088a4a26d34d5f0c7280b50892763144e4da)
2013-05-30 17:43:55 -04:00
Jessica McKellar f51d0ce001 onboarding: only show the app popover on mouseover once.
(imported from commit 45d9c7de583e3243e0e65f09392fb15ad5ea2043)
2013-05-30 17:43:55 -04:00
Steve Howell bbd2322586 Show unread counts for mentions in left pane.
(imported from commit b4511b1d95f58010904c97f55d6189dd2a97cf1b)
2013-05-30 16:59:22 -04:00
Steve Howell 468de0a29f Fix autoscroll mousemove bug.
We had a couple places where autoscroll would
mysteriously midway through scrolling, and it
was because scrolling generates mousemove
events.

(imported from commit 666e5e5af81fdcc5cc56c314d1264dbec970c067)
2013-05-30 15:04:42 -04:00
Steve Howell 3f1b3af002 Add "Mentioning messages" to the upper left sidebar.
Treat "mentioned" messages like "starred" messages for narrowing.

Lots of ugly copy/paste here.  There might be opportunity for
some cleanup in places.

(imported from commit e7629890d42643c0000e1cc85422b2a0690f2cc4)
2013-05-30 14:45:01 -04:00
Keegan McAllister 371d0dbaa0 Identify app.js source map using a special comment
If we're going to minify third party code, the size heuristic may not hold
anymore.

(imported from commit 78ada1fee1446e78b3b1ad299ee3e975d1cd9002)
2013-05-30 13:51:46 -04:00
Tim Abbott 1cf2d993a6 Fix un-narrowing while the home view messages are still loading.
The bug we experienced here was that if you loaded the page in a
narrowed view, and then un-narrowed before the first block of messages
for the home view arrived via load_old_messages, then
narrow.deactivate() would re-select ID -1 in home_msg_list.  This ends
up calling recenter_view() on the message, which in turn tries to
access the message with message id -1, which fails.

We do sometimes re-select a message ID in order to recenter the view
properly when we prepend messages to a message list, so we can't make
this always a nop; instead we add a check for id -1 in the
message_selected.zephyr event handler.

(imported from commit 66f84a586e59d99aaf0e4ba2cda9fe597b033145)
2013-05-30 10:29:04 -04:00
Steve Howell b34fc4d78f Fix intermittent bug w/page downs at bottom of feed.
There was an off-by-one error in how we determine when
the message list was scrolled all the way to the bottom,
and this undermined our handlers for page down and scrolling
to get the pointer all the way to the bottom.

(imported from commit f80d11582b40726246e69c817a502b311081c730)
2013-05-29 18:42:38 -04:00
Steve Howell fc2c5eb70a Revert "Experimental navigation: t and b keys"
This reverts commit 13fb245f86ab84b1d2faea9d2a1f2145cd4aa907.

(Waseem wanted to hold off on adding more hot keys.)

(imported from commit 97c25ffa01fd7058fc90a278887d85b7d82a268a)
2013-05-29 18:10:43 -04:00
Jessica McKellar 80b13bdb73 Fix incorrect space character in several e-mail prompts.
(imported from commit 41bdbce2225a5eb5ab4057467d599d1341fcd9a5)
2013-05-29 15:23:26 -04:00
acrefoot c58ac9cc0c Re-focus on the compose box after a send
Re-focuses on the compose box after a send, but only if
the compose-box was opened by responding to the message
at the cursor (by hitting "r", enter, or clicking on the message)

(imported from commit 8e7560c8ea31397b57b2bc3e2e7d9dd996226a6f)
2013-05-29 13:07:45 -04:00
Steve Howell b3cb196452 Stabilize pointer after reply-to clicks..
The reply-to autoscroll was using a flag that was redundant
to suppress_scroll_pointer_update and then updating it prematurely,
which caused the pointer to move when you clicked on a message to
reply to it.  Now the pointer goes to the message you replied to.

(imported from commit e2f49fd6bd0da9a3f4b58c0eb08192ef0ee9abf0)
2013-05-29 10:11:39 -04:00
Tim Abbott ab093e7d9a message_edit: Fix traceback saving message edits.
Now that we sometimes call message_edit.end() twice, we need to check
if we've already cleaned it up.

(imported from commit 4e0efa14ba78df0a86b2ae97b99fa1be6197df88)
2013-05-29 10:11:08 -04:00
Steve Howell 975b984aee Slow down pointer adjustments at the bottom of the messages.
The main point of this fix is to move some more scroll-related code
into viewport.js, but it also fixes a bug where the size of #main_div
was not accurately representing the full height of the message list.
Making the calculation more accurate narrows the window where we
do pointer adjustements on mousewheel moves.

(imported from commit 5d821f459284c4dbd5ff8056001e54caf4355f1d)
2013-05-28 17:23:22 -04:00
Tim Abbott 968ef85ff8 Display the blank for new bots below existing bots.
(imported from commit 813fbf969d0fef508db1dc4acd02c1fc98f427fb)
2013-05-28 16:41:31 -04:00
Steve Howell b045d4e503 Uncover replied-to message by proper amount after clicking.
Fix min-height before doing the calculation of how much a
replied-to message is being covered by the compose box.  This
change also removes an outdated call to slideDown.

(imported from commit e5a3f35bbacff16dffae62c9e9f6bbc7978a13c1)
2013-05-28 13:45:43 -04:00
Jessica McKellar c50e05bc68 Focus on the correct textbox when you initiate a compose when narrowed.
The logic for this already existed, but start() was getting called
twice, once from compose.set_mode and once from the click handler, and
the result was the focus always being in the stream input box.

(imported from commit 9a832a118856b5705524975a4412b7e6e547ef5c)
2013-05-28 12:49:54 -04:00
Jessica McKellar 1ac44f0356 Expand the compose box in the correct mode when narrowed to PMs.
(imported from commit 68e4bb3091b855dafda8df3ca10737abb5d2f337)
2013-05-28 12:49:53 -04:00
Jessica McKellar c1a067857b Make clicking on a presence list name narrow you to those PMs.
This parallels clicking on a stream name, which narrows you to that
stream. This also gives you a discoverable way to narrow to PMs with a
particular person.

(imported from commit 6c706f0643f6a8ec20ac38360153227ec2f645ae)
2013-05-28 12:48:40 -04:00
Steve Howell 11430a58b7 Experimental navigation: t and b keys
This sets up the keys t and b to anchor your pointer to the top
and bottom of the viewport.  It empowers keyboard users who
are otherwise at the mercy of Barnowl recentering, but of
course it doesn't affect users who don't want to opt in.

(imported from commit 13fb245f86ab84b1d2faea9d2a1f2145cd4aa907)
2013-05-28 10:33:54 -04:00
Steve Howell 9cedca4dc5 Don't stop the autoscrolls for reply-to. Refactored.
The functional change here is that our code to stop
autoscrolling on certain events, particularly mousemove,
now only runs during system initiated autoscroll events.
If the user had been replying to a message, then the feature
to stop autoscroll was too aggressive.

This patch also starts to put more scrolling-related code
into viewport.js, which will hopefully prevent some code
duplication and give us a single place to control things like
stopping animated scrolls.

(imported from commit e7d5946b0ac7fcfda2eff1d0e2b58a78b44ecc1a)
2013-05-28 10:25:06 -04:00
Leo Franchi 10501c08cc Remove client-side mention calculation as it's done server-side via message flags
(imported from commit 603aa8aef69d486a8acda953ec72cdeeb7476dd7)
2013-05-24 21:23:58 -04:00
Leo Franchi b548538a98 [manual] Send UserMessage flags in get_events updates
This commit must be deployed in a separate step from the previous [manual]
commit

(imported from commit c6f00e217062790fce8380f61f82ea8824fb3722)
2013-05-24 21:23:58 -04:00
Zev Benjamin a74590ea12 Remove mixpanel wrapper
We can use mixpanel.disable, instead.

(imported from commit 1da1513de2f9e19b0c3149bb412030feba960f87)
2013-05-24 21:23:57 -04:00
Tim Abbott 8479b4f0cd [schema] Record and display whether a message was edited.
We also record the historical edits to the message in this JSON format:

 [{"prev_content": "new test message 14", "timestamp": 1369157249},
  {"prev_content": "new test message 13", "timestamp": 1369157118}]

but we don't actually do anything with the information as of yet.

(imported from commit 2d5ca449b87b33ad035ab0e076a22e150c8e7267)
2013-05-24 21:23:55 -04:00
Leo Franchi de8f43fec1 Add all unknown people to people_dict, even if they have only been PMed with
(imported from commit 01ca442127d5289a2cdfa5e9630aa928bea0b6eb)
2013-05-23 10:39:47 -04:00
Leo Franchi 98d8095391 Don't require people_dict to contain everyone you PM with
(imported from commit 003a5bf601366986c0f65d0e945d8e390ad581cd)
2013-05-23 10:15:58 -04:00
Leo Franchi 3be1acebaa Use canonicalized names when processing unread counts
(imported from commit 9a4a1d48221f10489a9dcf3ab2532b73b0c26e4e)
2013-05-23 09:56:43 -04:00
Leo Franchi c12fd08050 Use same canonicalization for stream names when calculating recent subjects
(imported from commit d934f67cb469728162b8ae48b5fc63805bf18d8f)
2013-05-23 09:56:43 -04:00
Allen Rabinovich f69762e612 Modify message box layout and spacing.
* Modify the narrow icon in FontAwesome to make it better align to the pixel grid and display well on Windows+Chrome.
   * Move the message controls to the right
   * Hide the message info icon until the message is hovered / selected
   * Switch the star to a gray version
   * Increase the size of the gravatar
   * Adjust the spacing
   * Add the right-side message pointer
   * Fix private message background colors and mention colors
   * Modify star count test to account for new stars
   * Bug fixes for stream subscription messages and other miscellanea.

(imported from commit 3d3d9de7e03f3658c5c78b492051b2b7f795487d)
2013-05-22 21:55:15 -04:00
Steve Howell 7cdbb0e6b0 Make auto-scrolling less aggressive.
This goes back to only scrolling by the size of the new
message, and it avoids scrolling in certain use cases.

(imported from commit f9e6380b779bb21283ba889715712b6b51633838)
2013-05-22 18:22:09 -04:00
Leo Franchi 3b7ddd72cf Don't throw an exception if we get an undefined stream
(imported from commit b6bbaf1fa14bec5fc43016f81e15caa32a9fb948)
2013-05-22 18:12:49 -04:00
Zev Benjamin 991630c031 Record basic versions of the operators used in narrows for metrics
(imported from commit 5c7cb3a62ebf0b2c1f0d8e9cae8d845cde9baf56)
2013-05-22 16:20:48 -04:00
Zev Benjamin 2ab5c7dd76 Fix race involving mixpanel load order
Previously, we were referencing the mixpanel objects only once, at
page load time, which meant that there was a race between metrics.js
loading and mixpanel completely loading.  Mixpanel starts with stub
methods and then replaces them once it fully loads, asynchronously.
If metrics.js ran before mixpanel loaded, we'd end up wrapping the
stub methods instead of the real versions.  Adding a layer of
indirection ensures that we always get the right method.

(imported from commit 6a8cfbf249168443956895b7a7e29bf7bb4222aa)
2013-05-22 16:20:48 -04:00
Tim Abbott a34d640eb3 Rename message_edit.cancel to message_edit.end.
(imported from commit 5c720100afbf1e86c09eb2567f465c42353f95ec)
2013-05-22 13:04:37 -04:00
Tim Abbott e68c6bb1da Fix race where message editing might be cancelled after rerendering.
(imported from commit 989f1eace526d351cdbd9e15de594964de09a770)
2013-05-22 13:04:32 -04:00
Tim Abbott d0df3d9b37 Revert "Fix that you have to save an edited message twice to complete the edit."
This reverts commit 87226d857845c6f16cb3bc0d6ab5bb748aca5987.

This meant that if for some reason there's a server error or network
failure trying to send in your edit, your changes are silently lost.

(imported from commit 2b5d19716fef1565b061a2b6c7cecc54f183b6f3)
2013-05-22 13:04:32 -04:00
Tim Abbott 67f84b06f7 Add support for changing colors in the stream popovers.
(imported from commit 30593148500a78c36baec87af5868d8c5a173d96)
2013-05-22 12:10:16 -04:00
Waseem Daher 6656869a92 signup: Rotate through cute placeholder names.
(imported from commit 59c1523d35cd80e904a173fefc614da2543b391d)
2013-05-22 11:32:18 -04:00
Zev Benjamin b565b2adc9 Add a bunch of debugging support for mixpanel
Currently, some browsers don't seem to be sending metrics information
to mixpanel.  This commit will make said browsers noisy, but should
help debug what's going on.

(imported from commit c5050f66d985eb76e38117b2668594fedfc10702)
2013-05-22 10:43:57 -04:00
Zev Benjamin 10dbfd0985 Record narrow metrics
(imported from commit d312115d384dd1f33e05dcd1b3f1dadc86e3fdf3)
2013-05-21 17:56:49 -04:00
Zev Benjamin d35c8f0c81 Track what user action triggered a narrow
(imported from commit 2b110dc27334e4b823810bfef13c3d10d36b3886)
2013-05-21 17:56:49 -04:00
Zev Benjamin d1ac16ee3f Record compose metrics
(imported from commit 194a7d36650cf3e1e52f0dad3f453942179de122)
2013-05-21 17:56:49 -04:00
Zev Benjamin c60a500a8f Track what user action triggered a compose
(imported from commit 3e23dd1f7e9e3a742b0c3b9e1b0eeb85cfa4c736)
2013-05-21 17:56:49 -04:00
Zev Benjamin a4bda36ab4 Add a wrapper to mixpanel so that we can selectively enable metrics collection
(imported from commit 1d72f2e98c4c756a8a988d08731282e4195b8e1a)
2013-05-21 17:56:49 -04:00
Steve Howell 5e64b9e90b Fix screen geometry for the tab bar.
Use tab_bar_underpadding to find out the top of viewport
that we can view.  Also, eliminate effective_page_size().

(imported from commit 0e2d777790552e77d635989e496f3446cefccb1e)
2013-05-21 14:45:38 -04:00
Jessica McKellar 8609c59781 Only show edit subject hint on messages you sent.
(imported from commit 613a023bf22b07f879864690142e9d5e0a56f0ef)
2013-05-21 14:19:56 -04:00
Jessica McKellar f4b99c8177 Fix that you have to save an edited message twice to complete the edit.
(imported from commit 87226d857845c6f16cb3bc0d6ab5bb748aca5987)
2013-05-21 11:04:56 -04:00
Jessica McKellar a6a3110bfb Encourage users to edit placeholder subjects with an edit icon.
(imported from commit 0bfe67876b237ea2fb4f523b23b9cdbbd9a4027a)
2013-05-21 11:04:56 -04:00
Jessica McKellar a3b6758315 Give a placeholder subject when users don't supply one.
(imported from commit ac6f0f7029c6a96c4c20562b02bee656436c70b2)
2013-05-21 11:04:54 -04:00
Steve Howell 33dd01885a Fix autoscroll to use ui.message_viewport_info().
This will make it automatically work if we add new tab
bar like things.  The current version of ui.message_viewport_info()
is slightly broken; that's a separate fix.

(imported from commit fa1906b738433223831250e3191dfd8e87d67daf)
2013-05-20 23:55:03 -04:00
Steve Howell 8738f330c5 Fix lint error in unread.js.
(imported from commit 2b6736dfbd03cb8de93ab9e38f471430bdcf6d61)
2013-05-20 23:42:22 -04:00
Steve Howell 62d6360a48 Extracted model code out to unread.js.
Most of the model logic pertaining to unread counts had been in
zephyr.js, along with a couple global variables.  Now the code
is encapsulated in unread.js.  It was a pretty straightforward
extraction with some minor method name changes.  Also, a small
bit of the logic had also been in stream_list.js.

Conflicts:
	tools/jslint/check-all.js

(imported from commit f0abdd48f26ab20c5beaef203479eb5a70dacfff)
2013-05-20 23:42:11 -04:00
Steve Howell c587a18646 Animate "Private messages" when new private messages come in.
Set the background behind "Private messages" to green whenever
a user's unread count goes up for private messages.  Remove
the background after 3s.  Advanced browsers will fade the
green in and out over 6s (3s up, 3s down).

(imported from commit 80ed9661d9eec1d697f3259854037d7e145615cd)
2013-05-20 23:41:40 -04:00
Tim Abbott 2bdecd130a Add user interface frontend for editing messages.
The only known outstanding bug with this is that it doesn't properly
handle the updating of a message's highlighting/presence in a narrowed
view (e.g. in theory, a message should disappear if it is edited such
that its subject doesn't match your narrow or it no longer matches
your search).  I think I'll just open a trac ticket about that once
this is merged, since it's a little hairy to deal with and kinda a
marginal use case.

Also it's not pretty, but that should be easy to tweak once we get the
framework merged.

Conflicts:
	tools/jslint/check-all.js

(imported from commit 2d0e3a440bcd885546bd8e28aff97bf379649950)
2013-05-20 23:40:57 -04:00
Tim Abbott d467a93877 Add support for updating messages after they've been received.
Currently the interface for editing messages is limited to a
command-line API tool; it's great for testing with e.g.:

./api/examples/edit-message --message=348135 --content="test $(date +%s)" --site=http://localhost:9991 --subject="test"

The next commit will add a user interface for actually doing the editing.

(imported from commit bdd408cec2946f31c2292e44f724f96ed5938791)
2013-05-20 23:40:26 -04:00
Allen Rabinovich 93a2e23e96 Change the layout of the message boxes in the message pane and make other message-related adjustments.
Specifically:
   * Leave the avatar image as inline and round it.
   * Move timestamp to the left column.
   * Replace the "Info" link with a permanent info sign.
   * Move the pointer bar to the left.
   * Remove borders
   * Change selection background colors, and PM colors.
   * Introduce the "narrowing" icon into our FontAwesome set.
   * Modify the tests to account for the new "narrowing" icon and fixed a bug in star-finding.
   * Clean up CSS and add a more prominent color to private messages

(imported from commit 8a8d6de8acccc52c0d16f5d1ce31aabdc72c88c8)
2013-05-20 23:40:17 -04:00
Steve Howell bafbc777e8 Allow scrolling during compose.
(imported from commit 0e39ba2048e7f0d2d91cc48f13e07fc69a5c4fc1)
2013-05-20 23:37:57 -04:00
Steve Howell 4ce6a6ea25 Fix auto-scrolling by not calling within_viewport.
The geometry used by within_viewport() is a little off to
begin with, but we don't want to check it at all in this
situation, because if the last messages falls out of the
viewport, we still want to scroll.  The relevant thing
to check is that available_space_for_scroll exceeds zero.

(imported from commit a0a6f0d23db2eab8d9f22fc9ad523031cf7f7ec2)
2013-05-20 23:37:57 -04:00
Steve Howell ecd3903007 Fix geometry for autoscrolling (part 1).
The prior code was subtracting out the compose box from the
calculation of available_place_for_scroll, which didn't make
sense when the compose box is at the bottom of the screen
and you're scrolling the current message up.  You could see
the symptom pretty clearly by seeing autoscroll stop exactly
the height of the compose box from the top.

(imported from commit cfceb85c8be80cca957ac4a3ad0bbf0de7425c48)
2013-05-20 23:37:57 -04:00
Steve Howell c2104e36c9 Fix geometry calculation for visible unread messages.
(imported from commit 91e5a6b83919c4cd935ea5e7586d84cc7a559cf6)
2013-05-20 23:37:57 -04:00
Leo Franchi a6486a1fa0 Add a tab bar at the top of the Message list to aid navigation
The intent is that this will also make it easier to tell when you are narrowed.

(imported from commit 5e37721fbad304d30fc725aacf2cc9e6560e9da2)
2013-05-20 23:37:57 -04:00
Steve Howell 69977ce825 Fix unread count in favicon when focusing window.
This fixes a pretty subtle bug where the window-focus handler
wasn't updating the unread counts in the title, but it was
hard to notice, because as soon as you moved the mouse, the
problem fixed itself.

Apart from fixing the bug, this patch eliminates the expensive
mouseover handler, which is a big win.

The fix to the window-focus involved some unrelated cleanup.  I
decoupled update_title_count() from received_messages(), as the
former method will probably live somewhere else soon.

Also, in order to get window-focus to update the title count,
I went pretty deep in the stack and added a call to
update_title_count() inside of update_unread_counts().  This
fixes window-focus as well as restoring that behavior to
code paths that were calling received_messages().

You'll see that call to update_title_count() is now adjacent
to the call to update_dom_with_unread_counts(), which is
fairly sensible, but then are calls to similar methods like
notifications.received_messages() that happen higher up in
the call chain, which seems kind of inconsistent to me.  I
also don't like the fact that you have to go through a
mostly model-based function to get to view-based stuff, so
there are some refactorings coming.

(imported from commit 2261450f205f1aa81d30194b371a1c5ac6a7bdec)
2013-05-20 23:29:56 -04:00
Waseem Daher 4480693f1a Signup page to collect beta customer info.
(imported from commit ce4e860aa6781aa74ca954c79ae133aa50a057f1)
2013-05-20 23:29:55 -04:00
Steve Howell f146362ea9 Simplified streamlist code.
I renamed set_count_internal to update_count_in_dom, because "internal"
was redundant in terms of saying the function was private, and it misled
me into thinking it was internal-only in impact, but it actually updates
the DOM.

I also removed the synchronous callback functions, since they both
led to simply hiding the count_span and clearing the text of the
value_span.

(imported from commit dea27d6414dc1b33818b24662f8246d687530b71)
2013-05-20 23:29:54 -04:00
Zev Benjamin 26b1192445 Defer some Javascript initialization code until the DOM is ready
This allows us to load our own code before most dependencies are
loaded.  Our compiled Handlebars files still need the Handlebars
runtime, so we can't move all of our minified code before
dependencies yet.

(imported from commit e2d0fa13f05a08fc3c2519790f7382e5eef6eca2)
2013-05-20 23:29:53 -04:00
Zev Benjamin f0f6af2b45 Don't try to show the user blueslip messages if ui.js hasn't been loaded yet
The user will probably get another error message later, anyway.

(imported from commit 4f52925600826366a8349fefc85d43b6e1923087)
2013-05-20 23:29:53 -04:00
Tim Abbott 1df794efdc Don't use all_msg_list to memoize add_message_metadata.
The problem is that if you load a browser window in a stream narrow,
add_message_metadata will be called for the messages in the narrowed
view before it is called for the messages going into the main view
(thus inserting them into all_msg_list), resulting in duplicate
copies of messages.

This would be mostly OK except that we call
process_message_for_recent_subjects inside add_message_metadata, and
that function assumes it is only called once on each message
(otherwise it'll double-count the message).

(imported from commit a3e7f85874100cd93a6d07684605da04d9cc80c7)
2013-05-20 23:29:53 -04:00
Steve Howell 64fffc5b23 Account for navbar/composebox/etc. in determining visible messages.
Created a function message_viewport_info() to return more accurate
effective viewport info and called it from process_visible_unread_messages().
Also killed off a tiny bit of dead code in process_visible_unread_messages().

(imported from commit 985fcf2fb447dbf1026e2de37574c255a9bd6196)
2013-05-20 23:29:53 -04:00
Steve Howell e744c0ced6 Ensure we process visible messages on narrowing event.
Whenever we get a narrowing event, it's possible for new messages
to appear visible, and we need to call process_visible_unread_messages().
This has been a bug, but it's mostly obscured by the fact that we
call process_visible_unread_messages() as part of focus/scrolling
events.

(imported from commit b9447977f8e2272d45865ca67b436cacafd58a03)
2013-05-20 23:29:53 -04:00
Luke Faraone 3f37f88255 Grey out sidebar streams if they're not in the home view.
(imported from commit 4fdd1cb13ba36264803facb59ecf05c40056a59a)
2013-05-20 23:29:53 -04:00
Luke Faraone f9b82f2ab8 Add a dropdown menu to the sidebar.
This allows you to compose to a stream, narrow, or hide it from your home
view.

(imported from commit 183eb85af3401de592bae61a61409ffcc116eb45)
2013-05-20 23:29:52 -04:00
Luke Faraone 6dc3ef5ea8 Break out toggling a stream in the home view into a separate export.
(imported from commit 175b5f47685e60100d6fb7c4f9c4c18ffbe12cbe)
2013-05-20 23:29:52 -04:00
Zev Benjamin 60e479bdf1 search: Parse quoted strings as single tokens
(imported from commit 252f2657881ad4184a2564d16bf11558613efead)
2013-05-17 01:02:34 -04:00
Zev Benjamin aa761aad1a Placate the closure compiler
This works fine on prod, but after a new install-server, the closure
compiler complains about a side-effect-free for loop init.

(imported from commit aa0e4d788abe4c819d4d912d6a526fab4f676675)
2013-05-17 01:02:34 -04:00
acrefoot 47c8062e2f Compose box doesn't reply, and remove new stream/PM buttons
This removes the large "New stream message" and "New private message"
from the left sidebar. It also makes the default action when clicking
inside the composebox the same as the "New stream message" button used to
do (instead of replying to the stream-subject pair at the current cursor).

(imported from commit 316f03a35b781aca4c42555f74b99c4332ff42de)
2013-05-17 01:02:33 -04:00
Steve Howell 763782a6f0 Isolate stream_list.js's DOM manipulation when updating unread counts.
This refactoring basically splits off two functions from update_unread_counts(),
which then becomes a simple three-liner.

The function get_unread_counts() is extracted, and it's purely functional
computation.  It paves the way for a more pull-based approach to getting "unread"
counts, where other parts of the program can just call it to get values as
needed without worrying about side effects.  It is staying in zephyr.js for
now.

The other function is stream_list.update_dom_with_unread_counts(), which
has a new home in stream_list.js.  It handles all the DOM manipulation
aspect of unread counts in the left pane, mostly by delegating to smaller
functions within stream_list.  Some of those smaller functions can now
be turned into private methods FWIW, but I'm not sure it's worth the
trouble.

(imported from commit 799f9ebbaed8d530829a4741ef14be04bd8abf5a)
2013-05-14 15:21:27 -04:00
Steve Howell f024a7ab14 Call process_loaded_for_unread() more directly.
This is a prefactoring to eventually eliminate the home_unread_messages
global variable.  More commits to follow.

In order to set up process_loaded_for_unread() not to modify
global variable to get its job done, we want to pull it out of
add_messages(), so that add_messages() doesn't have to pass back
state to the 9 different places in the codebase where it's called.
There are only 2 places where process_loaded_for_unread() get
called after this commit.

In order to facilitate pulling up process_loaded_for_unread(), I
made it so that the contract for add_messages() was to accept
already-hydrated messages.  This way I could hydrate the messages
before calling process_loaded_for_unread() without have to
worry about double-caching them in add_messages.  This will
slightly improve performance, but it was mostly done for code
clarity.

(imported from commit ad5aaad5b1f22c31647370f4c9dcb5f89d7d99a7)
2013-05-14 15:21:27 -04:00
Jessica McKellar 8a3f51dca0 Put a prominent Feedback icon to the right of your feed.
(imported from commit a18cb1f73d342a683515270956305ce387b3af19)
2013-05-14 13:43:58 -04:00
Tim Abbott a4c5c24029 Use the event system to sync onboarding steps across browser tabs.
(imported from commit 29311390133aca8f3a3d79fbe06dbbcabc4fb6ea)
2013-05-14 10:27:40 -04:00
Jessica McKellar 976ceb2a1d Display onboarding steps, waiting until after the tutorial for new users.
(imported from commit 2b6a1cfdad98349995c48c376caede64ed391241)
2013-05-14 10:27:40 -04:00
Jessica McKellar bd9d7bb2dc Update onboarding checklist on message sends.
(imported from commit 0d7f8b53432b22c7d3593fe51e7f0cdd8e13c8ba)
2013-05-14 10:27:40 -04:00
Jessica McKellar f37540bbda Add onboarding UI functions for displaying and completing setup items.
(imported from commit 9ba9cb09d5ad2845ceeda436f89f7d22a19c3fbc)
2013-05-14 10:27:40 -04:00
Jessica McKellar 76a57e78ed Enumerate onboarding steps client-side, and give a way to update them.
(imported from commit 0a993976e898cdb20ebb814a19d520572ef8b7e6)
2013-05-14 10:27:39 -04:00
Tim Abbott f87e62a8f3 Show unread counts for the home view in the left sidebar.
(imported from commit e56da93c45dff30ae150b0da676bab2278d25718)
2013-05-13 11:58:58 -04:00
Tim Abbott 14feac48e7 All PMs are in the home view.
(imported from commit c5e1a06fe39322f6065f2e56ef00b5f2f0e8aaf0)
2013-05-13 11:58:58 -04:00
Tim Abbott 8f29a39991 Remove the newer_than_pointer_count hack in unread accounting.
This was a workaround for a number of other bugs we had, but at this
point just serves to make debugging more difficult.

(imported from commit 6662b7854c265bd8016f6c8ce75a095731211a45)
2013-05-13 11:58:58 -04:00
Tim Abbott b7e682b157 Fix home view unread counts being 1 lower than they should be.
(imported from commit c9f9a623e862eaf9cb38626318df855ef7bad993)
2013-05-13 11:58:58 -04:00
Tim Abbott 91f8768fb7 Fix private message unread counts never displaying.
(imported from commit fda193ceba36dba2cd7b0694e15d1b927365dc26)
2013-05-13 11:58:58 -04:00
Zev Benjamin 43794983e7 Fix a bug where the stream list would not get resorted if you unsubscribed and then subscribed from a stream
(imported from commit 9bde14f49d05062478fb5f356c24b29bedcdf3fc)
2013-05-13 11:44:56 -04:00
Zev Benjamin 7b3f5ed14c Add interface for creating and viewing bots
We really should not be storing bot API keys in the DOM and should
require some sort of additional authentication before showing them,
but this seems reasonable for a first pass.

(imported from commit c7d75aa52e21894bf53917457e771c18de38bbcc)
2013-05-11 02:38:32 -04:00
Jessica McKellar 237b1077ed Factor out recurring message flag update AJAX request.
(imported from commit 7c0986b33ce57f7a1c58500a0006daeaaea0c87b)
2013-05-10 18:00:57 -04:00
Jessica McKellar c7555c6cf9 Add support for completely collapsing messages through the info popover.
(imported from commit 0a01c4cc8f99019233659c175d73826e16cc95ee)
2013-05-10 18:00:57 -04:00
Waseem Daher e0f1949cb4 Grow the composebox when we click on it.
The idea here being: if there's only one line, it discourages
me from writing a long message (and also makes me think that
enter will send).

(imported from commit 424d8d305d1965ce3199ce3227dac94b395945bc)
2013-05-10 16:22:17 -04:00
Steve Howell 898a69f42a Fix Pagination when user hits PgUp/PgDn/Space. (ticket 1237)
This commit takes control of keyboard-based pagination away
from the browser, so that we can use the effective viewport
size as the amount to page, as well as keeping a little bit
of overlap from page to page.  There had been issues with
pagination for a while, but the introduction of the always-open
composebox particularly aggravated the situation.

(imported from commit 45b9b7d5a6b322230c9d55e1be0b763dbce06e2e)
2013-05-10 15:36:24 -04:00
Jessica McKellar dd837c3c9b Don't let closing a modal clear your compose content.
This is the easy way out -- our compose logic needs a refactor
eventually.

(imported from commit c82fc31cadbe9edbd50aba6f8446b4ba9a311055)
2013-05-10 15:28:14 -04:00
Steve Howell b35c102815 Fix typo regression on top_navbar (minor).
(imported from commit 69ac7d32db0eb382db30448c89a50319562a5881)
2013-05-10 14:13:24 -04:00
Steve Howell 85ded308e9 (Refactoring) Extracted get_new_heights() out of resizehandler()
(imported from commit 13707f0d188676b96d4cad1d091b447435a22229)
2013-05-10 13:31:47 -04:00
Leo Franchi 1267ffe542 Show unread counts next to expanded subject names
(imported from commit 6de1145cdec8d7e68395c1f9a7a95cd59136d805)
2013-05-09 10:41:32 -04:00
Tim Abbott 4968b804fa Change to the home tab when clicking stream filters in left sidebar.
(imported from commit c0cd7e233a29e2b2f2c348b8f977ea0d18e56fba)
2013-05-09 10:35:49 -04:00
Tim Abbott 8d6551e37d Send notifications when a message appears offscreen even if focused.
Previously we never sent desktop notifications when the browser was
focused, even if the message appeared offscreen.  After this commit
there are only a few cases when PM or other notifiable message doesn't
trigger a desktop notification:

(1) You sent it yourself
(2) It was onscreen when it arrived while your Humbug window had focus

(imported from commit e381c02c0e6794594d6934f57249a11ba2a88210)
2013-05-09 10:35:49 -04:00
Tim Abbott b1f75e8d3f Clean up notifications.received_messages.
This is trying to make the logic flow clear -- e.g. we check once, at
the beginning, for whether the message is notifiable, and the checks
for whether the various notification settings are enabled are more
parallel.

(imported from commit a68c71a53055191bc16682a85f739ed8e40ddeae)
2013-05-09 10:35:49 -04:00
Steve Howell 92d6e80d57 Fix bug with uploading the same file twice using the clip icon.
See #1234 for details.  When you upload files the old-school way
(no drag&drop), there was a bug where you couldn't upload the same
file twice, due to us intercepting the change event and not clearing
out the file list when we were done.  Tested on Chrome, but uses
a known IE workaround.

(imported from commit 8120c2e8bce41f3964f4f5c21aad3a85df0e433d)
2013-05-09 10:35:48 -04:00
Leo Franchi 4173862833 Send notification with missed message to users if they received a PM while offline
This is configurable in the user's settings on Humbug

(imported from commit 80bf6d7a6f0dc3811117548e2225865db8b533d9)
2013-05-09 10:35:48 -04:00
Steve Howell 13bc2e1859 Handle "REQUEST ENTITY TOO LARGE" during file uploads.
The filedrop library has a few canned errors, but it seems to mostly
let server errors come through.  We try to trap 413s to give a more
descriptive error than "unknown," but this is just a bandaid fix,
and we should see what's wrong with our prod configuration.

(imported from commit eac26406866d80340f24dbdca9f34408ddb92462)
2013-05-09 10:35:48 -04:00
Zev Benjamin 50fa22a3f9 Add utility for profiling iteration constructs
(imported from commit d4e55353475b86ba06da2d776fce2453cd33cc84)
2013-05-09 10:35:47 -04:00
Zev Benjamin 1b5fb31b2c Make viewport a module that caches height and width values
The .height() and .width() functions are actually pretty expensive for
the number of times we call them.  The viewport height and width
don't change often, though, so we can just cache them and recalculate
them on window resize.

(imported from commit 129fb8c058144125e2974f6b7967cd9f1a5c9ead)
2013-05-09 10:35:47 -04:00
Zev Benjamin 4de79cf723 Make within_viewport take the row offset and row height
The .height() and .width() functions are actually pretty expensive
for the number of times we call them.  The callers of within_viewport
already know the offset and height of the row, so we just pass them
in so the values don't have to be recalculated.

(imported from commit d1c077bd87463d695f0bbe337b6a8b04ac2d17ce)
2013-05-09 10:35:47 -04:00
Zev Benjamin 02dc15f426 Only re-render the streams list when the sort order has changed
(imported from commit 8122785097e2470e9e85f1f4c40bf1cd63264fa4)
2013-05-09 10:35:47 -04:00
Zev Benjamin 466beef6fe Optimize sort_narrow_list
The optimizations are:
* Sort over the list of subscriptions instead of the DOM li elements.
  This requires storing the li elements for each sub on the sub object.
* Do a bulk insert of the li elements instead of doing them one by one.

(imported from commit 1a987799930fc677e25f0bc2dcf66f83a4ac3163)
2013-05-09 10:35:47 -04:00
Zev Benjamin 45ba7c41e7 Don't generate a new favicon if we don't have to
(imported from commit 30e88dfddbdcd2343ce53270fece767d924c48f0)
2013-05-09 10:35:47 -04:00
Zev Benjamin ad6de0d401 Don't export several functions from stream_list.js unnecessarily
(imported from commit d8649259e07494fc70e5529e0cf627fdacc120a1)
2013-05-09 10:35:47 -04:00
Zev Benjamin 1f2529ba39 Do stream side-bar manipulation in event handlers
(imported from commit 27392dc6d05c6fa581c0370488e6baba0b11ce0f)
2013-05-09 10:35:46 -04:00
Zev Benjamin 7becd3e504 Move stream sidebar functions to their own module
(imported from commit 50771c1590eb3a0dbb151bf6a798bd14a4418857)
2013-05-09 10:35:46 -04:00
Zev Benjamin ceac6b0613 Fire events during different stages of subs.js subscription management
We now fire three events:
* subscription_add_done - fired when subs.js has finished handling a
  subscription_add event (all structures are set up, etc.)
* subscription_remove_done - fired when subs.js has finished handling a
  subscription_remove event
* sub_obj_created - fired when subs.js has created a sub object. This
  happens both when a new subscription is added and at page startup for
  all existing subscriptions

These events are fired whenever sub objects are created, even when
not tied to a subscription event.

(imported from commit a4863451f37e7fdbad480696b388ea788b01d6b9)
2013-05-09 10:35:46 -04:00
Zev Benjamin dc82d60c13 Remove no longer true comment
(imported from commit d06ce85ff76a8c9bd5691c004e9a77182ac295dd)
2013-05-09 10:35:46 -04:00
Waseem Daher 4892895d6b Additional always-visible-composebox fixups.
* Start a compose when we do a file upload
* Restore the "Formatting" and "Feedback" links.
* Dismiss composebox error messages when we defocus composebox

Realistically, the "correct" way to do this is not to have to
explicitly manage the composebox's state, as we do now -- it should
just be 100% visible and ready to send any time you click 'send'; it
shouldn't need to have first been composebox.start()ed.

(imported from commit 7f1725c229ed968a9b5500b25d600306173182a0)
2013-05-09 10:35:46 -04:00
Steve Howell cee31a4f4e Fix unescaped angle brackets in search typeahead.
This was a pretty recent regression in the logic for
highlighting search typeaheads.

(imported from commit ba226f9cc7d6b09744ea07ef516fee280f23e048)
2013-05-09 10:35:46 -04:00
Steve Howell 58c1110635 Put streams lower in typeaheads and kill off some dead code related to search
(imported from commit c7d50f44a4de6cc5049e51ef4b671cc49902c466)
2013-05-09 10:35:46 -04:00
Steve Howell 77d2d669de Fix highlighting for stream typeahead in compose box.
Recently the typeahead for streams in the compose box was modified so
that streams only matched queries when the query was a prefix to the
stream.  When that change was made, the old highlighting behavior
had been mistakenly left in place.  This commit fixes the highlighting.

(imported from commit b7ec33daba46978df58eb91306686a4f1a57c7fa)
2013-05-09 10:35:46 -04:00
Waseem Daher 328da1fa07 Assorted always-open-composebox fixes.
* Properly resize compose area when we cancel out of it.
* Re-enable clicking on 'reply' in popover.

(The issue with the latter is that clicking on "Reply" started
a reply and then bubbled up and triggered our code that canceled
a reply because you clicked out of the composebox.)

(imported from commit 25d0ea58b72d2ee246217baf3eb9cac58fc858f5)
2013-05-09 10:35:46 -04:00
Waseem Daher 9384870ffa Always-open composebox.
Really, the "correct" way to do this is to undo "scrolltheworld", and
then just have a compose div that always lives underneath the message
list div. (This will also allow us to deal much more reasonably with
the whole "Is the composebox in focus" thing.)

In the interest of prototyping something more rapidly, though, we
adopt the somewhat more hackish approach, with the understanding that
much of it will probably be simplified later.

(imported from commit e2754be155c522b6dac28e7b84c62bd2030217c8)
2013-05-09 10:35:46 -04:00
Steve Howell 96100bb42a Highlight search typeaheads for streams
(imported from commit e8725fe8c4f4985d46e48fdab5003e3e9def9bd1)
2013-05-09 10:35:46 -04:00
Steve Howell 667a47755e Highlight search typeaheads for senders
(imported from commit 80e16d47507b0c23103aa1e574961cc5e29cac6e)
2013-05-09 10:35:46 -04:00
Steve Howell e47b98df38 Highlight search typeaheads for private messages
(imported from commit e3c5525255c70e507f33f24fc305d4a268c87e42)
2013-05-09 10:35:46 -04:00
Steve Howell 8a8e7c22f1 Don't try to rebuild subjects for an unsubscribed stream.
(imported from commit 2fea180bd5c989cb9aac843c837200acb10ddbc6)
2013-05-09 10:35:45 -04:00
Steve Howell 64ba2864bc Match names w/prefix and turn off highlighting.
(imported from commit 4ebc4aba5d05173ad6b8176d47fdf062e23c1441)
2013-05-09 10:35:45 -04:00
Steve Howell 0f75cbd30f Match any word in stream for typeahead queries
(imported from commit bd6ee91ae880c7fb3dd118cd2f024820ced73466)
2013-05-09 10:35:45 -04:00
Steve Howell de8106d923 Refine search (sort people by # of pms, limit streams to prefix-only).
Also minor configuration changes and no need to clone list.

(imported from commit 9f9c7259ed479fc29cd66fe260d9d81017e5f48f)
2013-05-09 10:35:45 -04:00
Steve Howell 0164d9f757 Search typeahead has more suggestions and sorting.
(imported from commit 5386be57e7f0b820e1a9cbd166c9c43e5e72215b)
2013-05-09 10:35:45 -04:00
Zev Benjamin 26ea7e0897 Build the recent subjects list on demand
We previously kept the lists in the DOM for all streams and updated
them all when new messages arrived.  This was very expensive for
large numbers of streams, so we now just build the subject lists on
demand.

(imported from commit 937ad4322ce2014200aeae8645f79875f6af576e)
2013-05-07 11:47:13 -04:00
Zev Benjamin 8702d37028 Do narrow-related side-bar manipulation in event handlers
This commit also fixes a bug where "starred messages" wouldn't get
bolded when you narrowed to starred messages.  However, it also
introduces a regression where subjects aren't highlighted correctly
on load to a narrow which will be fixed shortly.

(imported from commit 411575d92762e41d04c1baf126c0ab1dfb4225a5)
2013-05-07 11:47:13 -04:00
Zev Benjamin ca95167da1 Move several initialization calls to after we've set up event handlers.
This will matter shortly as hashchange.initialize can call
narrow.activate(), which fires an event handler.

Really, I have no idea why we have these initialize() methods anyway
and we don't just do initialization on document.ready.

(imported from commit 3a6a80e1426b03439b95cae3f142a4b1c43125e9)
2013-05-07 11:47:13 -04:00
Zev Benjamin 43829b4288 Fire an event on narrow and unnarrow
(imported from commit f3e5e5435ea425c4d3887b43824e53a1c817fa6f)
2013-05-07 11:47:13 -04:00
Zev Benjamin beba14a86c Only call add_message_metadata once when receiving messages in a narrowed view
We memoize add_message_metadata by checking if the message is already
in the all_msg_list.  Therefore, we need to add messages to that
message list before we add it to the narrowed_msg_list.

(imported from commit 4346179376ef6f982162c02c6152a0d294bfb2c0)
2013-05-07 11:47:12 -04:00
Zev Benjamin 96129b1cf0 Speed up string comparison for sorting
The String.localeCompare function is really slow, at least partially
because it creates a locale-aware collator object each time.  So now,
when we can, we create and cache a locale-aware collator object.
However, this is not supported on most browsers, so we fall back to a
non-locale-aware comparison.  This is not ideal, but for now we are
mostly working with English-speaking customers.

(imported from commit 51aa02e3b9fe4a0ef0cb084874fe26e91c57f65e)
2013-05-07 11:47:12 -04:00
Leo Franchi 5e70253bf9 Only remove a filter when unsubscribing if subscribed
Addionally, print out a blueslip error instead of dying
if a stream id is accessed when there is no stream to get

(imported from commit 0d6466ca79312a4fb9a235f313303ac5246afb35)
2013-05-06 13:52:35 -04:00
Leo Franchi 57d5bcf1f8 Only update unread counts if you're subscribed to that stream
(imported from commit 100047ad6ca1818cdf1c19dfafd0b2e06d95e380)
2013-05-06 13:52:30 -04:00
Leo Franchi 0da2f51ddb Calculate presence information with delta between server timestamp
(imported from commit b4b367ed620878e6d01287cb1aaae0730c7475c8)
2013-05-06 13:52:23 -04:00
Luke Faraone 6bc2d21b87 Make audible notifications a tunable.
This decouples from Chrome notifications, which gives us cross-platform
support in at least modern browsers.

We log this action so its replayable in our message logs.

This implements the model change indicated by the previous schema commit.

(imported from commit b21213cdde54f43670bbb0bf1f607147fc732b38)
2013-05-03 15:08:49 -07:00
Luke Faraone 734b91c8d4 Play a sound when you recieve a desktop notification in the app.
We test if the user supports sound in their browser, then determine which
sort of sound their browser supports.

When, whenever we show a desktop notification we also play a sound.

(imported from commit dae41e70a6e4f6ed60ffedaac546d77baee52675)
2013-05-03 15:08:48 -07:00
Steve Howell 6304a30257 Handle multiple casings of same subject in subject list. (#1227)
(imported from commit f1f675cd96a6d26c5b039d8f41c9373bc365cb45)
2013-05-03 14:28:23 -04:00
Tim Abbott 54ae352e83 Fix narrowing to a stream/subject pair when not subscribed.
(imported from commit 0ea2893dc6026df5316dd927f7d740c74dc2c02e)
2013-05-03 11:40:06 -04:00
Luke Faraone b77ca230ab Fix JS lint error in composebox_typeahead.js
(imported from commit a0008e895e439b37658d31449587d20763e52aa7)
2013-05-03 08:20:45 -07:00
Leo Franchi 9362731e4d Mark messages behind pointer as read when moving pointer
(imported from commit 7e1d3d7124aec239a8fdd24da4aab682a41ff435)
2013-05-03 11:14:47 -04:00
Leo Franchi 33eef54c5b Re-send unread message counts if XHR fails
(imported from commit 062e76ca7db177540ed4e9ab0d331b9ecc2ee5f1)
2013-05-03 11:14:46 -04:00
Steve Howell fa5a7fbf0b Force prefix match on stream typeahead in compose box.
(Also allow up to 3 matches.)

(imported from commit 88d707cedc88ab55685e6b03dbd7c87caa05057d)
2013-05-03 10:12:43 -04:00
Tim Abbott 6b85eaf16f Only mark messages in all_msg_list as unread.
(imported from commit 8c76ee8be918beeea44e70cba702fa45abff2297)
2013-05-02 15:35:46 -04:00
Tim Abbott f6fb62ca93 Fix narrowing to stream names that don't exist.
(imported from commit 2d0ff1ffdf32eef6df56d6e9ab00c9c6e4e7ee6a)
2013-05-02 15:35:46 -04:00
Tim Abbott 03fe751005 Clarify confusing narrow-by-stream selection of active stream.
(imported from commit a90059ed62c47ac03bca0fa306adeca3ce577d43)
2013-05-02 15:35:46 -04:00
Tim Abbott 525a20de2e parse_narrow: Handle malformed narrow URLs gracefully.
Since they can't be parsed, probably the best thing to do is to send
the user to the home tab; we could add in showing an error message but
then we'd need a way to clear the error message -- better to just have
this work.

(imported from commit 67c0475ff06eb0431621eef60b9c50287a158232)
2013-05-02 15:35:46 -04:00
Tim Abbott 2c9c5f6093 Clean up code duplication when calling add_narrow_filter.
(imported from commit da397f015427e7c5b01fa1e89ba119ff87cda168)
2013-05-02 15:35:46 -04:00
Tim Abbott e7d04ff60f Fix encoding of narrows with '.' in the URIs.
(imported from commit fa624c0f810817b8093aeb4e3fb4329cad4cf9fb)
2013-05-02 15:35:45 -04:00
Steve Howell c02540bfa6 Show lock icon in compose box for invite-only streams (811)
(imported from commit c563fa605d850f39c3b3f0ae9530700f1d1b6e73)
2013-05-02 13:39:34 -04:00
Zev Benjamin ea55ed5ebb Use .attr() instead of .data() to access stream and subject names from the sidebar
The .data() method tries to coerce the value of the attribute into a
Javascript type, which is not what we want when the stream name looks
like a number or some other Javascript type.

(imported from commit a5f639d2ef98435cec6beacf3837fc185474a955)
2013-05-02 12:50:24 -04:00
Zev Benjamin 3b6713d545 Improve message_range's running time
We also now check that start != -1, as that is probably a mistake.

(imported from commit 7065ed40150fda7b373d137129c0944a8fa03fc1)
2013-05-02 12:03:18 -04:00
Zev Benjamin bea819e039 Don't mark all loaded messages before the pointer as read on page load
On page load, the scroll_finished function was being called and
scroll_start_message was -1.  This caused us to mark all messages
that we loaded through the messages initially visible as read.  This
was particularly problematic because message_range iterates over all
message ids between its two arguments.

(imported from commit d93209d466797939cc9dbdbe76d25a5b20195bd2)
2013-05-02 12:03:18 -04:00
Zev Benjamin 7c672e85a9 Look up stream sidebar elements by id
Previously we were doing quadratic work in the number of streams
because we had to iterate over all <li> elements every time we added
a new one.

(imported from commit 60cb97f77d161e9d8c3072157fa9c57c58f7af52)
2013-05-02 12:03:18 -04:00
Zev Benjamin 16cd33f756 Only pick a new color if the new subscription doesn't already have one
(imported from commit 7ccba8ab3ee52e81a8e553a43dce4c8bfc17f1fc)
2013-05-02 12:03:18 -04:00
Zev Benjamin 419f49c8be Cache the available colors instead of recomputing it each time we pick a new one
Since we pick a new color every time we add a new subscription and
recomputing the available colors was linear in the number of
subscriptions, we were doing quadratic work on page load.

(imported from commit 647ff3cb82f405755711da47701f005e7bc0023e)
2013-05-02 12:03:18 -04:00
Zev Benjamin 54bd4516ed Only update recent subjects after all messages in a batch have been processed
We were previously doing this on every message.  Because
update_recent_subjects is linear in the number of streams in the
sidebar, this became very slow when we enabled the streams sidebar
for the MIT realm.

(imported from commit 95cd71d83bbcc08cc6c5c79ca567b5d6b9b17173)
2013-05-02 12:03:18 -04:00
Zev Benjamin a640da16df Sort the streams side-bar only after all streams have been added
We were previously calling sort_narrow_list after each stream was was
added.  Because it is linear in the current length of the sidebar
list, we were doing quadratic work on page load.  When we enabled the
streams sidebar on the MIT realm, this became problematic because of
the number of subscriptions Zephyr users have.

(imported from commit d60ddc638f0a81fbce08eecd6671e9ea6ca38515)
2013-05-02 12:03:18 -04:00
Zev Benjamin ec3c0fffb7 Remove no longer true comment
(imported from commit 84c4e6bfbf16460efe5703e1a4213383a27fbe79)
2013-05-02 12:03:17 -04:00
Waseem Daher 5887d9c576 Condense messages in a fail-safe way.
Messages are now explicitly condensed by our JS, which means that if
we run into some bug where our JS doesn't run, you still see the whole
message (rather than getting a clipped message).

(As of this commit, this can happen when you, e.g. are on the
Settings page and someone sends you a message.)

(imported from commit f3bec97800ea1852c80203e73552ee545fcc7e8a)
2013-05-02 09:52:26 -04:00
Zev Benjamin e1c8d2f50f Return match_subject and match_content from messages_in_narrow()
This fixes a bug where if you were narrowed to a search and received
a new message that belonged in that search, the message would appear
to have an empty subject and content.

(imported from commit fe1dbf584d3659d57c5b70c7eb45cb22bbc9732f)
2013-05-01 21:52:04 -04:00
Leo Franchi d0b8a2fd21 Mark messages as read when using the End key
(imported from commit b2495cb27b1362d037e786db7f108540f2ce655b)
2013-05-01 17:26:19 -04:00
Waseem Daher 435098d001 Process message condensing in narrow.activate rather than hashchange.
Previously, we were having this problem where:
* You narrow to something
* That causes message_list.js:process_collapsing to run on all of the
  elements in the view, which changes some of their sizes
* That causes the pane to scroll and either push the content up or
  down, depending (since stuff on top of where you were is now a
  different size)
* That triggers keep_pointer_in_view, which moves your pointer

Moving process_collapsing into narrow.activate doesn't obviously
fix any of this, but it does seem to mitigate the issue a bit.

In particular, we (a) process it less frequently, and (b) process it
immediately after we show the narrowed view table, which seems to
reduce the raciness of the overall experience.

This does, however, introduce a regression:
* If you receive a long message when you're on
  #settings, e.g., and then go back to Home,
  the message does not properly get a [More] appended
  to it.

(imported from commit b1440d656cc7b71eca8af736f2f7b3aa7e0cca14)
2013-05-01 16:56:03 -04:00
Tim Abbott 9f0fc7c031 blueslip: Include window.location.href in error reports.
This can be useful for debugging what sort of narrow is happening in
addition to the URI decoding bug we're currently experiencing.

(imported from commit 0cb55fec4ac1afa986c747eb79236b4300c9e636)
2013-05-01 16:10:35 -04:00
Tim Abbott 57c5ea365a Enable the left sidebar for the MIT realm.
(imported from commit d69eba7fd7a95dd88892706c3d36485c71831864)
2013-04-30 18:38:13 -04:00
Tim Abbott 203fc55a7c Sort the narrow list better when there are more than 40 streams.
This shouldn't have any effect in normal realms, but for realms like
mit.edu that have large numbers of inactive streams, it will sort all
the streams that have had a recent message at the top (aka those that
aren't effectively inactive).

(imported from commit 027ce258d04b6fd58705e49f769dec7e0639bb38)
2013-04-30 18:38:13 -04:00
Zev Benjamin c08a86aeb9 Use server-highlighted subject and content when narrowed to a search
(imported from commit 0579193da040db77f9c7937d3714cb9ffeaf7ed8)
2013-04-30 11:40:27 -04:00
Zev Benjamin 8b3e800bf5 Use the filter on MessageLists when adding messages
(imported from commit c9070e5413352aef612b4763c35a4c72f4ecb852)
2013-04-26 17:45:25 -04:00
Zev Benjamin 8474675076 Attach Filters to MessageLists
This should allow us to stop special-casing the narrowed message list
as much.

(imported from commit 1eb7216fbd8aa16b796c239a189d6ce0008344f9)
2013-04-26 17:45:25 -04:00
Zev Benjamin 4f4e982ed1 Don't do narrows with search operators on the client
(imported from commit 98e6a06f5c10a384e6295b3281d23a061ecdecab)
2013-04-26 17:45:25 -04:00
Zev Benjamin 3b8b8a7d4e Fix 'in' search operator
(imported from commit b42c9ef8d00c92ea117f124b933791478098c5b7)
2013-04-26 17:39:08 -04:00
Zev Benjamin c5c0a2ab45 Canonicalize Filter operators early
(imported from commit c251fab94970c127708c1b40b25e57d4afeb7ce9)
2013-04-26 17:39:08 -04:00
Zev Benjamin 0c15db4aff First steps towards making narrow.js more object-oriented
There's still a lot to do here.  For example, the external code
should probably go through the new Filter object directly instead of
indirectly through the narrow module.

(imported from commit 22dcd31cdebd51453f1658af52a4432b2fe7a4cb)
2013-04-26 17:39:08 -04:00
Zev Benjamin 6cdc3f67df Only fetch an extra message in get_old_messages if a narrow isn't specified
In the case where we're getting old messages for a narrowed view, the
anchor message id might not actually be in the result set so there's
no reason to fetch an extra message.

(imported from commit e610d1f2cb95be3ff9fce6dc95e40c560bc5bf84)
2013-04-26 17:39:08 -04:00
Allen Rabinovich 6970f2deee Corrected the removal code for temporary copy div
(imported from commit 9e3963a3ce4e7039464ab3c8de5939361d7802e5)
2013-04-25 15:11:56 -07:00
Jeff Arnold 88348a8dc7 Prevent XSS vulnerability by avoiding treating message text as HTML
Addresses #1205

(imported from commit 229c65ae48d509bf3b71ed7cbfcc1fbeb60d14c5)
2013-04-25 17:33:04 -04:00
Waseem Daher ccc5363f3c Make text-underneath-compose-box all nicely line up together.
(imported from commit d4676d95ccad18f65a29447647581b41d53dfa9a)
2013-04-24 17:49:45 -04:00
Michael McCanna ce1389dc35 Remove double subscription when "creating" stream
When you create a stream that you'd previously created (then unsubscribed from),
it was possible to end up in the subscribers list twice. Once came from loading
the subscribers list from the backend, and once came from a bit of mark_subscribed
logic that only gets called if you've subscribed to that stream at least once before
in the current session.

resolves trac #1196

(imported from commit e47ff139a9c25b1b8689ea6795dfad96ae8d2591)
2013-04-24 16:21:14 -04:00
Allen Rabinovich f8397e42c2 Adding an "Attach files" button to the message composition pane.
Changes include:
   * New markup for the button in compose.html
   * A hidden file input field in compose.html
   * Added reference to the file input field in filedrop
     initialization in compose.js
   * A feature test and a click event binding for
     the "Attach files" button in ui.js
   * New paperclip icon reference in fonts.css
   * New general hidden display classes in zephyr.css
   * New composition pane button classes in zephyr.css

Fixes to the "Attach files" button commit e673bda...

Changes include:
   * Fixed the feature test for (new XMLHttpRequest).upload so
     it works in Firefox.
   * Renamed .button to .message-control-button
   * Removed stray newlines

(imported from commit c1f0834b74fd7120ec27db64ec380ffb3fa34633)
2013-04-24 08:59:13 -07:00
Tim Abbott 1c57956bf6 Avoid an unnecessary load_old_messages call on page load.
Previously, our check for whether we needed to call load_old_messages
a second time on page load to get up to the present caused us to
basically always do such a call.

(imported from commit b599041e8c0853b4c8c9ab2def6679142302523e)
2013-04-24 10:44:56 -04:00
Waseem Daher 5f28cf8e02 Restore tutorial's ability to see what you send.
The internal format of 'message' had changed, so prior to this commit,
the tutorial was receiving (a) internally inconsistent, and (b)
not-what-it-expected versions of the message.

(imported from commit 233b934e6b600bd59125d133fdf7443fd8f6bbf8)
2013-04-24 10:35:25 -04:00
Waseem Daher eab43f28f4 Properly compute the name of our tutorial stream server-side.
It's subtle, but the slice was in the wrong place and wasn't
actually truncating the stream name at all, so the client and
server disagreed about where the tutorial messages should go.

(It might be the case that we should accept the tutorial stream
name from the client directly, rather than computing it in two
places.)

(imported from commit 8273223f182e8ad36eaea1cbf75e1426fcfdfbab)
2013-04-24 10:32:30 -04:00
Waseem Daher c05c391c31 Use '===' instead of '==' to make the linter happy.
(imported from commit 6fee035ab4531d64ece6a49501f275c64e0f2265)
2013-04-24 10:32:30 -04:00
Waseem Daher 5951c7eb00 Don't send tutorial timeout message if we're no longer running.
If the system was waiting for you to reply and you replied 'exit', the
tutorial would stop -- but our thing that was waiting for you to reply
would continue waiting. It would eventually timeout and send you the
heartbroken "I didn't hear from you so I stopped waiting" message.

Chances are, you were unsubscribed so you didn't see it, but we
should still just not send it.

(imported from commit 694e442bc29b32efd59f08b4b8b5f573768aea21)
2013-04-24 10:28:33 -04:00
Jeff Arnold a251b12ec7 Don't trigger two events when our app changes the hash
(imported from commit c17a82b043c10927de149b105c6ceea5175b6f4f)
2013-04-23 16:13:26 -04:00
Jeff Arnold 0b9e509f41 If the user expanded a message, keep it expanded when we narrow
(imported from commit cbff6a8629df25b0b5b90bf6e10e9ea35e9a72ef)
2013-04-23 16:13:26 -04:00
Jeff Arnold 0c657f6fc5 Process collapsing every time we show new content
(imported from commit 21899206e9012023d3fec08f3990474fa38047e7)
2013-04-23 16:13:26 -04:00
Jeff Arnold 1cf946969d Fix name of hashchange.zephyr event in changehash
tabbott noticed this mistake during some pair programming

(imported from commit 3b5885f50929e3ed0062eef4e5f3aba0a14d52bc)
2013-04-23 16:13:26 -04:00
Tim Abbott c4e4b481bd Increase the threshhold for triggering collapsing./
(imported from commit c09b5ac43b4521bcbb2ab3feb5334fc9cf9ba1a5)
2013-04-23 16:13:26 -04:00
Jeff Arnold 3f68ff3ac3 Don't collapse messages that would only be collapsed by a small amount
(imported from commit 2cdd1ef1c731c7e6ac122f431ccf91d41d8f9234)
2013-04-23 16:13:26 -04:00
Jeff Arnold 70e5bd4049 Automatically condense long messages
Addresses Trac #747.

(imported from commit 4ddf2d8773023805650f04924be62da2d0fe826e)
2013-04-23 16:13:26 -04:00
Michael McCanna bd00e2609e add mouse movement as a trigger to stop autoscroll
(imported from commit 746bab4983d8267e5c37c0232f04e2c8f9f06e2d)
2013-04-23 13:23:07 -04:00
Tim Abbott 71203a996a Fix autoscrolling on new messages.
This was apparently broken by the final revision of our fix to the
autoscrolling+narrow bugs, because it attempted to use jquery's
animation queues to restrict which animations were stopped, and this
doesn't seem to work.

(imported from commit cf97f9f56dc5a16d1aa0322b5e6ec432a76d3be2)
2013-04-23 12:54:59 -04:00
Tim Abbott 4e03ed0b7e Fix narrows_by_subject treatment when a private message is selected.
Previously, we were calling util.same_stream_and_subject on a pair of
messages, one of which was a private message, which is not valid.  We
should have instead been calling util.same_recipient, which checks the
message type as well.

(imported from commit bc5715807036bff1fd4f214dafad00e33678e91d)
2013-04-22 16:21:34 -04:00
Zev Benjamin 41e2bd3f40 blueslip: Fix BlueslipError definition
This fixes a problem where normal exceptions weren't triggering
blueslip.

(imported from commit 1cc0f8bcf0676eb2aa34ebd74d93af29251c5823)
2013-04-22 16:04:51 -04:00
Tim Abbott 26b0eb341e Fade around new recipient when restoring a draft.
(imported from commit 7888ae124bfba150b354ba27cb12c99364b43263)
2013-04-22 11:14:56 -04:00
Jessica McKellar de902be108 Add client support for restoring a message draft.
(imported from commit 64da07d4f9a7ba8e1548271f98e455ecd202da4a)
2013-04-22 11:14:03 -04:00
Tim Abbott 679c409ca3 Rename message content option to compose.start to content.
(imported from commit 4d609e6f6915af4474955b054d834efaba4327b9)
2013-04-22 11:14:03 -04:00
Tim Abbott bc60be9ad5 Clean up the send_message processing of the message recipient.
(imported from commit 1e6d7783901743650cfb759b3136ae1de0f2989e)
2013-04-22 11:14:03 -04:00
Tim Abbott de5038f4d7 Store the recipient stream name in message.stream.
Previously we were using message.display_recipient everywhere, which
is actually pretty confusing.

(imported from commit a58471172e28c039af8e290362e54b6660543924)
2013-04-22 11:14:03 -04:00
Tim Abbott 6e00c9ca3d util: Compare recipient streams by name, not recipient id.
This is more consistent with how we compare subjects etc., and can be
used for comparing the subjects of a potential future message that
doesn't have a recipient id yet.

(imported from commit 93251c62dc74b3f12c6140b12fc8d6c756d35f37)
2013-04-22 11:14:03 -04:00
Allen Rabinovich e28cef697f Switched the star icon to FontAwesome and made it bigger and green.
* renamed the 'icon-star' style to 'icon-vector-star' to keep backwards compatibility for icon-* classes
  * changed relevant styles in zephyr.css; added FontAwesome assets
  * changed relevant CSS classes in base.html, left-sidebar.html, ui.js, message.handlebars
  * added new fonts.css to start consolidating all font-based assets
  * added fonts.css to PIPELINE_CSS in settings.py under 'portico' and 'app'
  * modified the stars test suite to reflect new star icon class name.

(imported from commit 3116fcfd4b5fb4edecd457da554fea616bb7081b)
2013-04-21 17:31:50 -07:00
Leo Franchi 1d930e8c43 Show paste file name when pasting
(imported from commit 8648ef26085f5f01fbc1ddf85b2de1ad1bab2967)
2013-04-19 18:04:50 -04:00
Leo Franchi 80e8e7b21e Allow dropping of raw text and urls without showing an error
Don't show an error if we can't handle the drop contents, since it may
just be empty rather than being a browser unsupported issue

(imported from commit 986495b4a94f4afacf75ffb35ea507d86c369b2f)
2013-04-19 18:04:50 -04:00
Jeff Arnold 7b87c201f0 Revert "Automatically condense long messages"
This reverts commit 057f08f2fcef43070b0838a600f6a89c479b4ee8.

(imported from commit ba1dbfcaeef6bc1d5befb2d59122217f532065ac)
2013-04-18 21:45:59 -04:00
Jeff Arnold 13f5d30d83 Revert "Don't collapse messages that would only be collapsed by a small amount"
This reverts commit 56e8df87d3eae62080962474eae23ab75f009819.

(imported from commit 15d71ab73d269eaa3d8a2f52c5781290ee183627)
2013-04-18 21:45:34 -04:00
Jeff Arnold 955f1febdf Revert "Increase the threshhold for triggering collapsing./"
This reverts commit cd1dac8b4726cef82eb2dc957fc7edced298fa9c.

(imported from commit 6ddaad88d3d2b402ef162e5b9a7e450238feb5fd)
2013-04-18 21:45:13 -04:00
Tim Abbott 3811bcc025 Increase the threshhold for triggering collapsing./
(imported from commit cd1dac8b4726cef82eb2dc957fc7edced298fa9c)
2013-04-18 15:39:45 -04:00
Jeff Arnold cce1213320 Don't collapse messages that would only be collapsed by a small amount
(imported from commit 56e8df87d3eae62080962474eae23ab75f009819)
2013-04-18 13:17:22 -04:00
Luke Faraone ea7965d9bb Rework API documentation to cover all supported calls.
We now generate our API documentation page based off of JSON source.

(imported from commit 0e8a91ef4278684dbcad89cad39a1977672245fc)
2013-04-18 09:57:56 -07:00
Jeff Arnold 33c8368734 Automatically condense long messages
Addresses Trac #747.

(imported from commit 057f08f2fcef43070b0838a600f6a89c479b4ee8)
2013-04-18 11:29:32 -04:00
Jessica McKellar 1bd5f788b3 subs: remove redundant call to add_sub after create_sub.
(imported from commit ad47d9e9964a850892baeff17d3c94cfedbc9f0f)
2013-04-17 13:27:48 -04:00
Jessica McKellar 3e9e8eec1b tutorial: move script creation down the file to appease the linter.
(imported from commit 77b2b18874a19b39ec0a60c3c25b8459b50ce9ee)
2013-04-17 13:27:48 -04:00
Jessica McKellar 7d389d8c13 tutorial: fix broken pipelining of asynchronous requests.
Some functions invoked by the make_script framework weren't returning
their Deferreds. I noticed this as the hello stream not getting picked
correctly because loading your real subs hadn't completed yet.

(imported from commit fac3fa36b77585bd5c03bf8fbaec052fe397a481)
2013-04-17 13:27:48 -04:00
Jessica McKellar e15dd90bd9 tutorial: don't recommend saying hi on a tutorial stream.
Now we don't unsub you from it until after we've picked the hello
stream.

(imported from commit b1489007e972af7713804ba5ff98764a6393a0b6)
2013-04-17 13:27:48 -04:00
Jessica McKellar 750b8326d7 subs: fix incorrect stream_info re-initialization.
Using [] doesn't cause incorrect behavior, but it's a mismatch with
how stream_info is initially declared and gives you a confusing
representation at the console.

(imported from commit c03d9e6a29ff990659f41ee478f631a019a5ac25)
2013-04-17 13:27:48 -04:00
Jessica McKellar 6b4196a74a tutorial: fix race that could cause you to not see the goodbye message.
(imported from commit 52afce208890dbd863fc1661729e4351160d09ac)
2013-04-17 13:27:47 -04:00
Jessica McKellar 3945335e6e tutorial: don't let punctuation get in the way of exiting.
(imported from commit 7b97f382684bd2ddb92fc3efa6e1a635c4662aef)
2013-04-17 13:27:47 -04:00
Jessica McKellar a76977f57f tutorial: don't let the tutorial recommend saying hi on a non-existent stream.
Previously we added some names to your subs to use them as examples
during the tutorial. We no longer do that, but the tutorial could pick
a name from that list to recommend that you say hi on, even if you
aren't subbed.

Don't do that, and instead try to pick a stream that is in turn:
* your company name
* a probably-good stream name like social
* a stream that is hopefully not an alert stream like nagios
* eventually give up and pick anything

(imported from commit ec20c7722ea95b025dec62bcf47e33c62d1a8029)
2013-04-17 13:27:47 -04:00
Jessica McKellar bb315d4033 tutorial: remove CUSTOMER18 customer18stream1 hack.
(imported from commit b333fe10bf22aa5471b672fd51b2426191f259bf)
2013-04-17 13:27:47 -04:00
Jessica McKellar ac4385e410 tutorial: don't start the tutorial until you're subbed to the tutorial stream.
Also handle the case of subscribing failing.

This race could cause you to not see initial traffic from the tutorial bot.

(imported from commit 395a2968555e20a4dbc106dfa9d5790e9f102a3e)
2013-04-17 13:27:47 -04:00
Jessica McKellar 1c437cb0ff tutorial: return the $.ajax Deferred from the subscription requests.
(imported from commit d9154b00720b6055077e4f0e7f92313d121032b4)
2013-04-17 13:27:47 -04:00
Jessica McKellar 6a0c1f66d8 tutorial: factor setting tutorial status into a function.
(imported from commit 3ec355e3bcad25bbe8dceb9a1fdb9e8cce5156ca)
2013-04-17 13:27:47 -04:00
Jessica McKellar 95d0f383f2 Update star title hover when you toggle it.
(imported from commit 46f66566c1c59619e45371f3cc51ba15dc645273)
2013-04-16 14:08:31 -04:00
Tim Abbott 82da2bec10 Add trailing bookend with current subscribed status in some narrows.
This is basically just the logical extension of the previous commit
for the case where the last thing we did was subscribe or unsubscribe.

This even magically updates when you subscribe or unsubscribe from
another window :).

(imported from commit 2399329d11bf66aa0b614a21d2b3cf4035452279)
2013-04-12 15:43:41 -04:00
Tim Abbott bad18f6971 Display heading on boundary between historical and non-historical.
(imported from commit b1669725d5a10ae086d04d0aa03341bcb0b8b858)
2013-04-12 15:43:41 -04:00
Tim Abbott 738ed84b5d Call load_old_messages on all narrows, empty or not.
This is required to get historical messages that might be within the
message ID range of your home view.

I think we could avoid calling load_old_messages on every narrow by
tracking when the user last subscribed to each stream, and if the user
subscribed before the first message in the current home view message
window (aka the messages used for the fast-path narrowing), don't call
load_old_messages.  This would happen almost every time.  But it would
require a schema change to do this.

We also remove the load_more_messages call from hashchange.initialize.
It is no longer required now that we're calling load_old_messages on
each narrow anyway.

(imported from commit 1c78c183e61392429592ae89d566315be7be8999)
2013-04-12 15:43:41 -04:00
Tim Abbott c56b0074e4 Fix visiting the app via a narrowed URL.
(imported from commit 1946f2b8f3ffba0729e4ad975aeac1887a0ed437)
2013-04-12 15:43:41 -04:00
Tim Abbott 6ca1cf8978 Rerender the message list when receiving out-of-order messages.
This should fix the problems we've been having with out-of-order
message deliveries, and is also an important prerequisite for showing
historical messages.

(imported from commit 77a18a526bf8ec4f1f70b776ac8b7e189d00bcf4)
2013-04-12 15:43:41 -04:00
Tim Abbott 13317c08b0 message_list: Remove ignored last argument to _render.
(imported from commit 95c1a40028d3cf40943cf195be9d288153e4e574)
2013-04-12 15:43:41 -04:00
Tim Abbott ca4baa01e0 load_old_messages: Clean up for_narrow parameter.
(imported from commit 1be9959ec3998371f24f9d11a9aa87e59d85aabf)
2013-04-12 15:43:41 -04:00
Tim Abbott 12416bb128 add_messages: Remove unused opts argument.
(imported from commit 5805348c39ec0db54b6bc6939ce2d85b4896500c)
2013-04-12 15:43:41 -04:00
Leo Franchi ecdb2acf79 Chop subjects to max of 5 regardless of timestamp of incoming messages
(imported from commit a58cd25d9c129729e0eb42ae090f4c715b5e20fe)
2013-04-12 12:47:41 -04:00
Leo Franchi f6984e4d23 Sort subjects properly
(imported from commit e2cb3d3c7e6dd3de09ffcfc6622e524fc4b7ff7d)
2013-04-12 12:28:04 -04:00
Leo Franchi 9130f6722f Show latest 5 subjects in sidebar when narrowed to a stream
This is a V1 of this feature. For now, the only way to expand is by narrowing
to the stream---future revisions may add a manual toggle if it is found to be
useful.

Additionally, showing per-subject unread counts will be coming in a future revision
as well.

(imported from commit fb5df0d27e928fa3b0f32b9ff2c1c508202cf7e5)
2013-04-12 11:51:09 -04:00
Leo Franchi 302cfcd48c Send client information for initial presence and process time differential
(imported from commit 99a51b7cc8b6c51c4e82757a984d07603b2980e3)
2013-04-12 09:11:40 -04:00
Leo Franchi 5d4b2305fe Send presence updates when a new user logs in for the first time, and when returning from inactive
This commit will incorrectly list past-online users as active, a shortcoming that is
addressed in the next commit

(imported from commit b018767df686f88c0ca939c067c573e4d7cea357)
2013-04-12 09:11:40 -04:00
Keegan McAllister ea3ce9c835 Accept any password with at least 6 characters
(imported from commit c6a7d7772820cee49eaaaa6c726a7f194a96e7f8)
2013-04-10 18:05:02 -04:00
Keegan McAllister af25f8a5f1 Add password strength checks to password reset
(imported from commit 3723d2bfa6012c3d4cef2199c5efd3530e9e6d2b)
2013-04-10 18:05:02 -04:00
Keegan McAllister 0962f7399d signup: Rename validation method
Otherwise it applies to all password-type <input>s, which is not necessarily
what we want.

(imported from commit da2bb86961f4ff1dcc48e89e51abac6dbea79548)
2013-04-10 18:05:02 -04:00
Keegan McAllister 01a20d9c56 signup: Don't display password validation message immediately
We now have the bar color to indicate (for most users) whether the password is
valid, so revert to the default validation behavior and don't validate before
the first blur.

(imported from commit 5c2f6e05a8796033942a2af62f244b61459ff1bb)
2013-04-10 18:05:02 -04:00
Keegan McAllister 1211061f6a Color the password strength bar red or green
(imported from commit 6b3fa7d3565a7e4f61a952fc26e1e9e564d894f9)
2013-04-10 18:05:02 -04:00
Keegan McAllister 966545403b Move password strength bar update into password_quality
(imported from commit 054d9487e325cff819e80fb0e1cb85f5c0db42d8)
2013-04-10 18:05:01 -04:00
Keegan McAllister 5487f794a2 settings: Clean up API key box show code
(imported from commit a8fc8c769ae11cb0bdab882ead4531ade5d2b12b)
2013-04-10 18:05:01 -04:00
Keegan McAllister f399e29fe9 settings: Hide password change controls behind a link
(imported from commit 6d0f3861ef97f45231d388378f429974e876ddbe)
2013-04-10 18:05:01 -04:00
Keegan McAllister 481f07d948 settings: Move success / failure indicator to the top
And scroll there on any error (previously, we would scroll only if we end up
submitting the form).

(imported from commit 63597c4da78ac92cd5c2314d6d174d178b1caaf3)
2013-04-10 18:05:01 -04:00
Keegan McAllister 3e31646567 Add a password strength check on the settings page
(imported from commit 68ae1732e62be076a4619b522009a76215d69757)
2013-04-10 18:05:01 -04:00
Keegan McAllister 07bb220194 Add a password strength check on the signup page
(imported from commit a44101485e49fd7a7951bda05ba10a021b6d3ee0)
2013-04-10 18:05:00 -04:00
Keegan McAllister 447dc0029a signup: Fix and clean up validation highlighting
Fixes #1154.

(imported from commit f50a3cb24d66e09b768e4e0702308c1c7f2c51d9)
2013-04-10 18:04:59 -04:00
Keegan McAllister c65f9b548f signup: Remove error / success class setting for send_confirm
Also seems to have no effect.

(imported from commit 2e2f913ee0f0f3b0620153bde68b8179ebb781a5)
2013-04-10 18:04:59 -04:00
Keegan McAllister 498ac0ed52 signup: Remove validation-failed class
It seems to have no effect and does not appear anywhere else in our repository
or in jquery.validate.min.js.

(imported from commit c4d2f730f3b680e15af17cefee34f6930e64ade0)
2013-04-10 18:04:59 -04:00
Keegan McAllister 63d739ef17 signup: Rename forms
(imported from commit cd7e90aa56da4982b627af757f8c4684f5103bc2)
2013-04-10 18:04:59 -04:00
Jessica McKellar 19d93ba970 invites: correctly focus on the email textarea once the modal is visible.
(imported from commit 97aa226f892b726e7456184a0d671e4f51079d3d)
2013-04-10 16:58:17 -04:00
Jessica McKellar 8ed1229328 invites: clear e-mails before showing modal.
Otherwise, if you get an error those e-mails are still around the next
time you try to invite someone.

(imported from commit b521a74f4d6c0d67271f804221f519d1aa7551ff)
2013-04-10 16:58:17 -04:00
Jessica McKellar 69753f228c hotkeys: fix assumptions that message lists are non-empty.
This fixes user-visible browser errors caused by trying to use the id
of messages in an empty message list.

One error could be triggered by trying to go to the end of your feed
with the End key during a reload.

Another could be triggered by trying to narrow to a stream or subject
using hotkeys while in an empty narrow.

(imported from commit a0e5456fd3b475aecac6eddd7104772baaf3aeb8)
2013-04-10 16:36:11 -04:00
Zev Benjamin f6a6a6b220 Add per-stream desktop notifications
(imported from commit b4a0576847b3aec1495f017ca9805febe80c9275)
2013-04-10 16:11:27 -04:00
Zev Benjamin b8a5ba56b9 Make check-box subscription settings' HTML more generic
(imported from commit 58c02449245bd03eedab1ee6eabebdbd972d1678)
2013-04-10 16:11:27 -04:00
Zev Benjamin 3424bbd8d7 Reduce client-side code duplication in setting stream properties
(imported from commit 879384fea499a2d30104d2bc1d96f16dbd867532)
2013-04-10 16:11:27 -04:00
Zev Benjamin a2010871e3 Make subscription properties less free-form
(imported from commit eda607c2abfa51d2dadddc7b9ecba3e2d0b5be4d)
2013-04-10 16:11:27 -04:00
Tim Abbott da8fa73a92 Fix duplicate narrow.deactivate() call via hashchange on Chrome.
I noticed that on chrome, calling narrow.deactivate() actually ended
up calling itself recursively due to the hashchange code not correctly
handling the fact that in Chrome if you set

window.location.hash = '#';

and then read out the value, you get '' back out.

(imported from commit 9b5047fbe0e2ac1846e5325d066c72306634c523)
2013-04-10 11:02:35 -04:00
Tim Abbott 55f606b417 Fix scrolling bug when unnarrowing after receiving a message.
What was happening is that if you un-narrowed immediately after
receiving a message (e.g. because you just sent it), the autoscroll
animation from the zfilt table would still be running after you return
to the home view, resulting in the viewport being scrolled to an
apparently random point in the home view (even though the pointer was
still in the right place).

This cancels the autoscroll animations whenever you do one of:
(1) hashchange (e.g. to go to the settings page)
(2) select a message (covers narrowing/unnarrowing as well as keyboard hotkeys)
(3) mousewheel scroll
since those are basically the cases where we set the viewport
scrolltop directly.

Arguably this should instead be something where we somehow detect
which scroll events are triggered by what and cancel for any scroll
event not from the animation or rererendering, but that seems hard.

(imported from commit f776021303404c87b36241c733b3d1bcb083163b)
2013-04-10 11:02:32 -04:00
Luke Faraone 429edfbdcd Insert a link with a pretty file name when uploading a file.
(imported from commit 1367004792e145afa19a02417fb564ad3662f576)
2013-04-05 13:39:08 -07:00
Luke Faraone 59684c20f2 Don't insert a link of "undefined" if the process fails.
(imported from commit ba7d2c8bc9a280225862bd5edce302735d916e61)
2013-04-05 13:38:55 -07:00
Luke Faraone 424c5b49ef Add a progress bar to show file upload progress from browser to Django.
When testing locally this bar sort of lies, because the actual bottleneck
is Django→S3.

In prod, our connection to S3 will supposudly be really fast so this won't
matter.

(imported from commit c9f4b4882cbfdf3bbb8180f1500f35d8481c1f39)
2013-04-05 13:07:18 -07:00
Luke Faraone b692e8fc99 Abort the XHR if you close the alert or cancel the compose.
(imported from commit 21540f7b290d3f55f8116f9940554a5feb8809d7)
2013-04-05 13:07:18 -07:00
Luke Faraone 0f10d1c6d4 Boostrapify filedrop errors.
(imported from commit b2ff2850e952f33af3e99fc14c21599f856345d1)
2013-04-05 13:07:17 -07:00
Luke Faraone f20f605376 [manual] Add file upload support.
This allows users to drag and drop content onto the compose box, storing
their data in Amazon S3.

New dependencies:
 - python-boto

(imported from commit 339874e483db5c36312c9ceae56db29da6ca0d99)
2013-04-05 13:07:13 -07:00
Tim Abbott bfd9287068 Append timestamp to URLs when getting templates on dev machines.
This prevents the templates from being cached by over-aggressive
chrome caching.

(imported from commit 1a1f7f697a823f6e806d3f2289c3bbda7e3f0d79)
2013-04-05 10:38:38 -04:00
Zev Benjamin a701083f71 Report additional information for "message in the middle of msg_list" errors
Hopefully this will help us track down what the problem is.

(imported from commit b8e30ee23ab8f1bf93525faa4f52ce9a4ccc9013)
2013-04-04 17:42:09 -04:00
Zev Benjamin d4acc3dd94 blueslip: Add mechanism for reporting additional information
(imported from commit 738bd3b8800e3b67497755580a2b7ccf66bb3829)
2013-04-04 17:42:09 -04:00
Zev Benjamin be04cff7c1 blueslip: Don't report some fatal errors twice
(imported from commit e50a324c3fc74e076b82c6154686a98e70ebed90)
2013-04-04 17:42:09 -04:00
Zev Benjamin b7cd8db139 Small code cleanup
(imported from commit d9f09e5a9b33be0b23ddae072a3021bb01a3de3e)
2013-04-04 17:42:09 -04:00
Leo Franchi 8fe82085c4 [schema][manual] Automatically subscribe users to default streams only after tutorial
(imported from commit 6511851c0aee2628bef597bf1310d6f96b0fd1d4)
2013-04-04 17:11:39 -04:00
Reid Barton 94c46a0af2 Tutorial punctuation tweaks
(imported from commit 0097cfad492de2658a2ab8a08fba0844ec6ba3fa)
2013-04-04 14:11:15 -04:00
Zev Benjamin 9d1548fe08 Add empty feed notices for private messages
(imported from commit e4067336f6b2e9e82b794599d30dfc3825852652)
2013-04-04 11:36:51 -04:00
Zev Benjamin de1f4b0be2 Remove all inline event handlers
This allows blueslip to catch exceptions from the event handlers on
these elements in addition to the other benefits that not using
inline handlers provide.

(imported from commit 2bdcb2496c6c08fa7228a20ce6164b527cf64e41)
2013-04-04 11:34:32 -04:00
Zev Benjamin 79d0e78130 Remove extraneous delete statement
The close handler will be called on cancel anyway, so we don't need
to delete in the click handler.

(imported from commit 0fcf4b0d1408312a0889f2b69e01207c9c3835fa)
2013-04-04 11:34:05 -04:00
Zev Benjamin a6058c40ad Wrap hashchange event handler with blueslip wrapper
(imported from commit 96ed0681964d36e13878e09a3f58a65c5a993aa0)
2013-04-04 11:34:05 -04:00
Zev Benjamin a2a48a5d95 Expose blueslip's callback wrapper
(imported from commit e8b2139519254ac9f3a9ec6031c5134c4d6c0fef)
2013-04-04 11:34:05 -04:00
Zev Benjamin 0e4aa6727b Convert to string before using string methods on search operators
Previously, narrowing to a stream name that only contained digits
would throw an exception.

(imported from commit dc76877427078d70e3d5625622c665be3302c976)
2013-04-04 11:34:05 -04:00
Tim Abbott fa239ea270 hashchange: Don't change the hash when called from hashchange code.
I generally don't like this sort of state variable, but I don't see a
better solution.  The codepath is that when you start out on the
subscriptions page and then click one of the left sidebar links to
narrow to something:

(1) hashchanged() would call ui.change_tab
(2) ui.change_tab triggers a gear change event
(3) The ui.js gear-changed event handler updates the hash

Resulting in the hash ending up at "#".  Since there's no easy way to
pass arguments through to the event handler, we just use a global
variable inside hash_change.js to track whether we're currently
handling a hashchange event.

(imported from commit 7bb905a223b5539240fc36de7896ee8074ebc62e)
2013-04-03 14:49:32 -04:00
Tim Abbott 200fd7ff70 Fix clicking on streams in left sidebar from subscriptions page.
We previously had 2 mechanisms for narrowing used by the left sidebar
-- the top few links used the hashchange mechanism, while the streams
links used a custom click handler.  Both were buggy -- the hashchange
one hadn't been updated to just select the first unread message,
whereas the click handler didn't change tabs.

Fixes #1141.

(imported from commit 8a8af974e78cc5c33937ac0078f04a9b5452b94a)
2013-04-03 14:15:07 -04:00
Tim Abbott 3a93c8cc90 Fix pointer jumps on unnarrowing after certain scroll events.
This appears to have been caused by our code for preventing the
viewport from being recentered if you move the pointer away from the
edge of the viewport from a position near the edge, which was being
run even when it was not triggered by a scroll event.

(imported from commit 0a4b3dcca75a6e5dbf1beb77a5249bd6a9c61341)
2013-04-03 13:38:41 -04:00
Tim Abbott 11ad134f7b Fix directional hotkey calculations for Home and End keys.
The old directional hotkey calculation system was fragile, and because
of this, didn't scroll when you used the home/end keys.

(imported from commit dca4786de13a4ed2864600dadbf4b1a5ba848074)
2013-04-03 13:37:23 -04:00
Leo Franchi 2f09492e71 Don't scroll to a message if there are no messages loaded
(imported from commit 8b881713595f60b3a989cb2c6875444e80c736d4)
2013-04-03 11:33:20 -04:00
Keegan McAllister 17d5406b55 [manual] Fetch Handlebars templates using Ajax
...rather than embedding them into index.html.

This is only acceptable for dev, but the next commit adds an alternative
mechanism for prod.

There isn't actually a manual deployment step here.  However, this commit won't
work on staging / prod without the next one (since we don't serve
zephyr/static/templates in prod).

(imported from commit dce7ddfe89e07afc3a96699bb972fd124335aa05)
2013-04-02 14:43:58 -04:00
Jessica McKellar 33a9bae5d1 Tailor empty narrow messages to what you were narrowing for.
(imported from commit 876afce2a63d4d6a522ac5300349b2be8805405f)
2013-04-01 14:26:50 -04:00
Jessica McKellar 6977920493 Don't try to auto-scroll when composing.
It's distracting, and may push messages you care about out of view.

(imported from commit 585d013c18d392433e432fc37bc02b4055822915)
2013-04-01 14:26:50 -04:00
Zev Benjamin ee9f040040 Handle subscription events in the web client
This has the nice side effect of not requiring us to trigger the
events manually in the success callbacks of our subscribe/unsubscribe
ajax calls.

(imported from commit e8d9970b708e9832d22be4803570071bacb46792)
2013-04-01 13:07:48 -04:00
Zev Benjamin 73af933f1f Handle the result of subscriptions by Javascript events
(imported from commit 7b564b1bf076581034021052fa5e2da20cf405c5)
2013-04-01 13:07:48 -04:00
Zev Benjamin bd81706558 Handle realm_user events in web client
We currently only use these events to change the autocomplete lists.
I figure that the presence list will be updated by presence events.

(imported from commit e9c1466659c4bfd463806656e0023984a4ea4177)
2013-04-01 13:07:48 -04:00
Leo Franchi 9817ef3460 Remove url encoding from data-name attribute as we match via iteration
(imported from commit 737418c430991414124daff41b62383284e86dc1)
2013-03-29 15:44:21 -04:00
Keegan McAllister b7bb598e02 Trim search operand from the end until URI decoding succeeds
Fixes #1137.

(imported from commit a23219d2cefdc2b739a165c88780fba409d4d878)
2013-03-29 10:37:02 -04:00
Leo Franchi a8816f81c0 Comment out blueslip scroll finish error to quiet emails
A ticket is filed and this error is not fatal to the UI but rather
a warning to investigate, which we will now do

(imported from commit 3f67ec2b503e91b3921e33b89febd97790e389f1)
2013-03-29 09:38:42 -04:00
Jessica McKellar ce66bdec5b Remove unused hotkeys.in_scroll_caused_by_keypress.
(imported from commit 65223a036e72489a41130a83e4537d0ccb80b90c)
2013-03-28 17:08:25 -04:00
Jessica McKellar 3df47f2025 Do not try to recenter if you were already moving in the right direction.
Before this commit, if you try to arrow around when the selected
message is outside the pointer threshold for recentering, you get a
big jump, even if you are arrowing towards the center of the viewport.

(imported from commit 5c15d5ccccdf027a8bfa8b79bf519fccbfa971d8)
2013-03-28 17:08:25 -04:00
Jessica McKellar 0f02eb17f4 Reduce code duplication in process_visible_unread_messages.
(imported from commit 49c36f704d9937ff06129a0b737a7d9ef32e35ed)
2013-03-28 17:08:25 -04:00
Jessica McKellar 07967e7257 Add the ability to narrow to starred messages with `is:starred`.
(imported from commit f1eb552ddd90a1822fa988b60dc13f88f04cfc79)
2013-03-28 16:59:59 -04:00
Jessica McKellar 3d683a93bf Add the ability to toggle a message star and save it server-side.
(imported from commit 6d9eda14cddee9ce65a85deadac57925b1864f94)
2013-03-28 16:59:59 -04:00
Jessica McKellar 2f560a79db Expose the `starred` flag as a client-side message attribute.
(imported from commit 3046a44e1313d0a91a1aa6ce6d166e29311a0567)
2013-03-28 16:59:59 -04:00
Zev Benjamin 00e5f904a3 Use do_events_register() in home() and pass the results to the initial page load
(imported from commit 532036c01bde1f5d49c43a96ce6aa496ca77cea9)
2013-03-28 16:57:48 -04:00
Zev Benjamin 0624a97d8e Force a reload when the server has garbage collected a client's queue
We have to be careful about timing here.  If Tornado fails to load
existing queues on startup then all clients will reload at once.  On
the other hand, if we don't reload immediately then the client won't
get any events until the reload.  For now, I've opted for the
user-friendly approach, so we need to make sure that Tornado gets a
chance to dump and reload its queues correctly.

(imported from commit 51a6ab31cb461e1e3373486dcec2e57eb12a8077)
2013-03-28 16:57:48 -04:00
Zev Benjamin 4bc9152f71 Inform clients to reload via a 'restart' event sent on Tornado start up
(imported from commit 10bb45547ea0bf34e56fc620ecd7415bb8a825c5)
2013-03-28 16:57:48 -04:00
Zev Benjamin 6cc70d94f6 Add register() call to event system
(imported from commit 0c9fbfec1866591b2169ce2da2bc2af6003f8f31)
2013-03-28 16:57:47 -04:00
Zev Benjamin b12715e3f2 Make web client use get_events instead of get_updates
(imported from commit 15c007fd89f02558b710e7146fc40b785934f76c)
2013-03-28 16:49:51 -04:00
Leo Franchi 0a419e51d0 Fix ui.set_count not finding streams that require url encoding in sidebar
(imported from commit c363669806f56650c6aecb66f7208ea692bfd613)
2013-03-28 14:44:57 -04:00
Luke Faraone 799e2873d3 Run decodeURIComponent over stream names before comparing them.
This resolves an edge case not handled in a previous fix to trac #1050.

(imported from commit 3fc142946b01de8955e1b52d4f4ebb36e584cdeb)
2013-03-28 11:24:38 -07:00
Leo Franchi 23802bc278 Filter out private messages in home view when counting in home unread
(imported from commit 6b42168e880269c8fe14f0e2eab98cf03b480f17)
2013-03-28 13:21:11 -04:00
Leo Franchi 5b2f4462fb Only count messages in home view when determining home_unread_count
(imported from commit 22a0a00bd242a4a12efc5dca723c13f7c9b47f2c)
2013-03-28 11:44:58 -04:00
Luke Faraone 60075e596f stream_exists_backend now returns a 404 if the stream is not found.
Update tests and compose.js to handle the 404.

(imported from commit d9ba4fe59c34bd14d9198e3365a845888fa04f03)
2013-03-28 07:53:37 -07:00
Luke Faraone fc2a071314 Scroll subscription settings into view on click.
Addresses a complaint brought up in our usability study.

We now hook into the "show" event on .subscription_settings elements and
do some obnoxious math to move the scrollbar the way we want.

Closes trac #1015.

(imported from commit 5d9cee1ffc242eb7b743fdccd2bd76bf0a7ba060)
2013-03-28 07:50:49 -07:00
Zev Benjamin 304899cd8a blueslip: Indicate whether users saw an error in the error emails
(imported from commit dd31976a3279df5ea5de2a0433387c82c8f80d41)
2013-03-27 21:53:58 -04:00
Zev Benjamin 4d30089220 blueslip: Only try to report a given error once every 5 minutes
This is in addition to only successfully reporting a given error once
per session.  Previously, if an error was triggered many times before
the ajax call to report the error returned, we'd end up making many
ajax requests to report the error.

(imported from commit 559179e3c8c3fbf03bbb091a67361d447c80b7bb)
2013-03-27 21:52:55 -04:00
Leo Franchi dbb2157457 Make home view unread count only count messages newer than the pointer
(imported from commit 0f699ed23f59380b04606bd30600373956f89ae4)
2013-03-26 18:34:16 -04:00
Jessica McKellar 297bc7f09b Don't hide the floating recipient bar when scrolling.
We made this change for performance reasons that don't exist now that
we only render a small portion of your messages, and it causes a
distracting flicker when you scroll through messages slowly.

(imported from commit 33379320f6b90d93ec8beac17323b287f8bb2485)
2013-03-26 14:06:27 -04:00
Jessica McKellar 9451451672 tutorial: streamline some sections, and bold user actions.
This may help with compliance.

(imported from commit 8ef250b07a0a1a7023bc74f89a46875c88fadef7)
2013-03-26 14:06:25 -04:00
Jessica McKellar 76dade3b6e tutorial: remove code formatting examples and just link to documentation.
Those examples make the tutorial feel much longer, and they aren't
relevant to people who aren't using Humbug to talk about code.

(imported from commit c3213775d26cf533b3d9bde691de08a53d427939)
2013-03-26 14:05:45 -04:00
Jessica McKellar 2fd56b3745 tutorial: de-emphasize that we don't auto-scroll.
It's not so black and white in a world where we auto-scroll at the
bottom, and we've observed that people trying Humbug over-focus on it.

(imported from commit 2057643f179d5d1666cb33438c5a513977197b37)
2013-03-26 14:05:45 -04:00
Jessica McKellar eaa2cc702e Autoscroll when you are at the bottom of your message feed.
(imported from commit 7ca92b13c874346f846aea8200a638a7914fe7d6)
2013-03-26 14:05:45 -04:00
Keegan McAllister 6d9aca5f1a Move "page parameters" (email, enter_sends, etc) into a single object
(imported from commit 842b2371bf6364982f1358f1cd2d91118c7fb2bf)
2013-03-26 13:50:03 -04:00
Keegan McAllister 38ebefe68f Remove unused variables
(imported from commit c18d43165c1dbdee28107ef21e26e474b819c653)
2013-03-26 13:50:03 -04:00
Leo Franchi 0184f31af0 Reprocess unread counts when subscribing to a stream.
This is required if the stream has unread messages in it
(from a previous subscription period). Otherwise the
unread count will be 0 until reload.

Fixes Trac #1117

(imported from commit 8f3d78eb52fdecb52456b0037cc89665c9027fbc)
2013-03-21 17:13:17 -04:00
Leo Franchi 4edf85e730 Mark messages taller than the screen as read once we have moved past them
(imported from commit c142c2447a8f2b5ed40337a75c1afbaf05f9fecf)
2013-03-21 09:37:10 -04:00
Jeff Arnold a95b1a1a23 Revert "Automatically condense long messages"
This reverts commit 27244550d5d94980d7e33d8cc7c69708427dbbec.

(imported from commit e468051b8052d244beb09ba795605d70124254dd)
2013-03-20 18:45:12 -04:00
Jeff Arnold c92d664b44 Automatically condense long messages
Addresses Trac #747.

(imported from commit 27244550d5d94980d7e33d8cc7c69708427dbbec)
2013-03-20 17:39:15 -04:00
Keegan McAllister 118cf4edec Modify encoding for URL fragment so Firefox doesn't decode it automatically
Fixes #826.

(imported from commit a4c0ada9559684db7e597686d9354219de742819)
2013-03-20 12:07:53 -04:00
Keegan McAllister e97c6f52ce Don't save narrow operators to the URL fragment if that's where they came from
In Firefox, prevents e.g. a slash in a stream name, which we wanted to store as
%2F, from converting back to a literal slash.

There is some appeal to normalizing the URL fragment after parsing, but in
general this way seems better.  It may decrease page load time on narrowed
views.

Doesn't yet fix #826; the URL is correct but the narrow is still wrong.

(imported from commit 32e3fa9e968139863f34b9698f1c8b39d06f0c14)
2013-03-20 12:07:53 -04:00
Keegan McAllister ae27deb30f Encode search operands using a cleaner-looking variant of URI encoding
Fixes #1098.

(imported from commit 1ed05248f3c6b69a48b9c74c0ce344621fe637b5)
2013-03-20 12:07:52 -04:00
Jessica McKellar 37e58b613d Truncate the tutorial stream name to fit the DB max stream name length.
(imported from commit e267656337f97d3ea14e14e957a405cf4fd2d06c)
2013-03-20 10:15:08 -04:00
Leo Franchi 6263c9ba1e Unify calculation of unread-count for notifications and use it in the title bar
Fixes trac #1004

(imported from commit 6f04d1d3ded198b46cc2ff1733b94b5c17beb581)
2013-03-20 10:09:40 -04:00
Leo Franchi 2ce683421b Only show 'More Messages Below" if there are actually more messages below
This fixes Trac #1004

(imported from commit fa57936aaf5b5f4ec74569bee389d18b989d6b9f)
2013-03-19 16:21:36 -04:00
Leo Franchi 6d6c3364dc Rewrite message flag handling to fork out to a subprocess for batch handling
(imported from commit 1ef846f542950cabf32f8b176f5591cf5794a0ff)
2013-03-19 09:55:12 -04:00
Zev Benjamin b08dbdfe48 blueslip: Send the user agent string back with the error report
(imported from commit ed77877465b1497cd3d78753c3398329302075ff)
2013-03-15 17:30:07 -04:00
Zev Benjamin 53a68144e0 Don't do processing for a get_old_messages if the message list it was for goes away
This was biting us before when the user would leave a narrow before a
get_old_messages call associated with it finished.  Specifically,
search.maybe_highlight_message() would assume a message was in the
DOM when it wasn't any more.

We also have to hide the 'loading more messages' indicator when
reseting the 'load more' status because otherwise it wouldn't get
hidden like normal in the load_old_messages() continuation, causing a
load_more_messages() not to fire when re-entering a narrow.

(imported from commit 4a136dd01305b039c0970f897b07e603b87d5d8e)
2013-03-15 16:40:05 -04:00
Tim Abbott a46eb8a36c Clean up excessive positional arguments to load_old_messages.
(imported from commit 072c0fcbd59256d55364a0fc6be42d5df8ab99e2)
2013-03-15 16:30:03 -04:00
Zev Benjamin a495b0dfa6 Re-educate rogue emoticon
He was wrecking havoc by confusing the Javascript mode syntax
highlighter.

(imported from commit 27900cf6b6dc7866f2b2f108e79d28d6785aa466)
2013-03-15 12:43:12 -04:00
Leo Franchi 96041be75c Use 'undefined' instead of -1 as sentinel
(imported from commit 30cc280d89cf0c290459f9d90960cd8eaf76a22f)
2013-03-15 10:51:25 -04:00
Leo Franchi 79dfe57840 Mark all messages between start of scroll and end of scroll as read
If the user scrolls super fast, our scroll handler might not catch
the user  passing by some messages.

(imported from commit 14cebffcd1321f02443971ac5e1c922db19648ab)
2013-03-15 10:43:17 -04:00
Leo Franchi 07433b80cc Don't mark your message as read if it comes from the API
(imported from commit 0570d4db590e21b0fadd544b10c9865fa7acd66b)
2013-03-14 15:51:21 -04:00
Leo Franchi 95c9c6817f Mark messages as read as you scroll by them
(imported from commit 7e4595dcbfe900bde7f062e3fe9e2d53c71b6884)
2013-03-14 15:51:21 -04:00
Zev Benjamin 719e24a25b blueslip: Use reference counting to try and break the circular references we create
We create a circular reference between handler functions and our
wrappers for them so that we can pass the wrapper to jQuery.off when
users pass the original handler to us.  This reference-counting
system can't break all the circular references we create because
users can unbind event handlers without explicitly naming the
handlers they want to remove (they can remove all bindings on an
element, for example).  For now, we hope that this memory leak isn't
too bad.

(imported from commit 9615b5761b4b09ca7ca52c0d847e9b83330373fa)
2013-03-14 15:07:28 -04:00
Zev Benjamin e8470b9481 blueslip: Also override jQuery.off so that we can pass the correct handlers to the original jQuery.off
Previously, we couldn't actually unbind some event handlers.  The
problem was that when a user called $.off(events, handler), the
passed handler wouldn't match any that were actually bound because
the handler that was actually bound was our wrapper.

This bug specifically caused the handlers for our idle timers to
never be unbound, effectively never cancelling them.

(imported from commit 48efac954994a05c356d326e64a78ab0ace9fe3e)
2013-03-14 15:07:28 -04:00
Zev Benjamin 8709e3f8b4 blueslip: Store the handler wrapper on the original function
We will need this for removing event handlers.  This will
unfortunately create a memory leak, but we'll partially deal with
that later.

(imported from commit e439cb44d245e16d2254d1be053b68015a1f4c79)
2013-03-14 15:07:28 -04:00
Zev Benjamin 122996b656 blueslip: don't double-wrap handlers when invoked with the $.on(types-Object, selector, data) syntax
(imported from commit 458ee9248fc82efc6c2307634b2be6d3ce32246d)
2013-03-14 15:07:28 -04:00
Zev Benjamin 22bb67150c blueslip: Do not catch exceptions from callbacks in debug_mode
(imported from commit 6ea79285dfd9f1f7b5d9f5d663a84247757d8af4)
2013-03-14 15:07:28 -04:00
Zev Benjamin dfe69eef0d Funnel exceptions from ajax handlers through blueslip
(imported from commit 5ad08482989d25a0fd0ee02251b74a23f950a0b9)
2013-03-14 15:07:28 -04:00
Leo Franchi 7510f87eac Select first unread when narrowing by clicking on stream in sidebar
(imported from commit 557751f44e3fee61b6a55f8f8328e2f97e6adc04)
2013-03-14 15:01:13 -04:00
Tim Abbott a0d0bdb5cf Fix copy/paste in compose box.
(imported from commit 075a461136e040b7d5d752e9386d9321d76c956e)
2013-03-14 14:55:14 -04:00
Tim Abbott cd4709c0f1 update_pointer: Only have one request in flight at a time.
Previously, if for some reason pointer updates were not returning from
the server, the client would resend its request every second, rather
than waiting for the previous request to fail before sending a new
one.

(imported from commit d134adc50aabd135c7631913fecab3519aca6640)
2013-03-13 17:41:33 -04:00
Tim Abbott 99d4bc114b Move Zephyr mirroring liveness check to the UserPresence queries.
It's closer to a presence query than an update, and more importantly
this moves this out of Tornado -- previously Tornado was spending at
least 3ms per recipient on messages sent to the MIT realm fetching all
this data to return back to users.  This should save around 100ms per
message sent to a popular stream the MIT realm -- but more
importantly, each such event is 100ms during which Tornado is not
processing other messages.

(imported from commit 134169f0fdcd9f6640fda957edc4a28b07783d8e)
2013-03-13 17:41:29 -04:00
Leo Franchi ff42774551 Refactor unread client handling to use 'read' flags per message
(imported from commit ca48745396e7fbac456e5eb2e7dbe4adc62b3492)
2013-03-13 14:14:45 -04:00
Zev Benjamin b9dd227bb5 Move seemless reposition on render code into _maybe_rerender
We also needed this when rerendering on append, so moving it into
_maybe_rerender allows the two places to share the code.

(imported from commit 027d99cae7864747cf1ec94c95e8ece495b5c907)
2013-03-13 14:07:22 -04:00
Tim Abbott f7ecfea7c1 Fix query for stream_name in compose module.
(imported from commit 8b8069a9fbf32805a77299e8375256e7a27e7ba1)
2013-03-13 11:22:11 -04:00
Waseem Daher 52b3da6668 Make clicking gravatar or "Humbug" take you home.
Looks like this was broken in 546063f88d58fb988363e5c89a13507deeb20afd.

(imported from commit 077186e60bf7a48742e71bbcb4e705c02f1ddc0a)
2013-03-13 11:16:09 -04:00
Tim Abbott 61ee8b1921 Unfade messages after you manually edit the recipient.
It's pretty confusing if this doesn't change.  In some other world we
could update the fade, but since we're currently only fading on reply,
I think it would be weird to update the fade when you're picking a new
recipient.

(imported from commit 8f77419d443d578068b57f847354ac6da7632ee2)
2013-03-13 11:12:25 -04:00
Tim Abbott 1e62ced172 Fix fading when replying to sender.
Previously, we compared the recipients of messages to the message that
you triggered the reply off of -- even if you did a reply-to-sender.
This commit changes the code to instead track what you faded by,
rather than just the message you faded on.

Fixes #1037.

(imported from commit d9e2cb4122501b1bc45e231d4b52c2e7f9284fdd)
2013-03-13 11:12:25 -04:00
Tim Abbott 24a235a091 compose: Move unfade_messages() call inside fade_around.
This makes the API a little cleaner.

(imported from commit c5eb9a4998971cdbe1f8ac3a14fd9759584771bb)
2013-03-13 11:12:25 -04:00
Tim Abbott 6c6a005920 Update recipient on renarrow when compose box is open but empty.
(imported from commit ff50b3b38833e7467ca77714acb1d81c22aeed0c)
2013-03-13 11:12:25 -04:00
Tim Abbott ee8d646d74 compose: Don't clear the compose box when recipient didn't change.
(imported from commit 5188a0f510e499c80d4c188a1ce59af4f2fe3262)
2013-03-13 11:12:23 -04:00
Tim Abbott 10be8d2a12 compose: Fix loss of message fading on renarrow.
Previously, if you renarrowed, all message fading would be cleared
until you close and then reopen the compose box.

Fixes #1024.

(imported from commit 57981ba29ab597c4c84ca6e4e9d04a8284f49117)
2013-03-13 11:10:51 -04:00
Tim Abbott 012f0566a1 compose: Fade all relevant messages on the page, not just neighbors.
(imported from commit 69e11a980b9cbd69753754b9a42248ef0f3d5a21)
2013-03-13 11:10:51 -04:00
Zev Benjamin 05eec2ae19 blueslip: Add some clarifying comments
(imported from commit 8b8ed83593d4dfb8ac3deb2c3442c2614481701a)
2013-03-13 10:55:34 -04:00
Zev Benjamin 09cf339c2b blueslip: Handle exceptions from jQuery event handlers and $(document).ready functions
We treat these exceptions the same way we treat fatal errors: report
the error message to our server and then allow the exception to reach
the top level.

We could also override document.onerror, but don't.  There are a
couple of ramifications of this:
* Exceptions caused by event handlers directly attached to DOM
  elements aren't handled
* Exceptions caused by code at the top level that triggers an error
  (such as parse errors in our Javascript files) aren't handled

The reason we don't override document.onerror is because the
document.onerror handler has a limited interface and doesn't receive
the exception object.  It only gets the message, file, and line
number of the error.  Additionally, exceptions that we allow to
propogate out of blueslip trigger an onerror event when they're never
caught.  In order to avoid handling the error twice (once by blueslip
and once by the onerror handler), we'd have to encode the fact that
the error has already been handled in the error message, which is
pretty ugly.

(imported from commit 7f049ae519dc198a9f7cfd41fd5dd18e584bd061)
2013-03-13 10:55:34 -04:00
Zev Benjamin 5bd4f2ccd7 blueslip: Throw a custom exception type
(imported from commit 4a3612b63bb4481a56901cc3dd6cea9a3d1a1aea)
2013-03-13 10:55:34 -04:00
Zev Benjamin 6d25940299 blueslip: Pass the stacktrace into report_error
This is to let us pass in the stack trace of an existing exception,
which will be required in a upcoming commit.

(imported from commit 421366a7a01deb770b7620417fb4660769c5db53)
2013-03-13 10:55:34 -04:00
Zev Benjamin a5b7c86303 Show an error message to users on fatal errors
(imported from commit a1ee2329e6b9dfa6f575106f1e32574bef0598a2)
2013-03-13 10:55:34 -04:00
Zev Benjamin fb0dd60857 Simply compose.check_stream_existence now that one of its return values isn't used
(imported from commit 8c910032e8ffd12b9691138ce03ceb096156e3f2)
2013-03-13 10:55:33 -04:00
Zev Benjamin 054d377709 Make stream existance error actually go somewhere
The referenced element where the error was supposed to go was removed
in 66fd42914e4fc33719c4f21ad401748989f20b49.  Now the error message uses
the regular compose error message area.

(imported from commit c82a6d863fa327ba982157d0b0607545d7e65cb7)
2013-03-13 10:55:33 -04:00
Zev Benjamin b383ee1dd4 Only report a given error message once per page load
(imported from commit 058fe321a991bbc50eed63b0bdbf75bcfa8afe2b)
2013-03-13 10:55:33 -04:00
Zev Benjamin 1109d20149 Send browser errors back to the server
(imported from commit 8c676017e8b3fc4f17552db15d32266099dba8f2)
2013-03-13 10:55:33 -04:00
Zev Benjamin 65d2f65bbb Check if we need to rerender after appending messages to the MessageList
Previously, if the pointer was high on the page such that there was a
lot of empty space below and the render window was full (a situation
we could get into if we're following new messages arriving), a newly
recieved message would not be rendered even though it would have been
visible on the screen if we had done a rerender.  Adding the
_maybe_rerender() call to the end of append() ensures that we don't
end up in this situation.

(imported from commit 925d3cc62e8221b42f1d5ff1788e99c7d07ccc24)
2013-03-13 00:48:26 -04:00
Tim Abbott c947fbd0e9 Revert "Disable backfilling 1,000 messages on idle"
Now that Zev's message list branch is merged, there's no longer a
performance penalty for loading these old messages, and it improves
our narrowing performance to have them loaded.

This code is slightly different from the original commit
93d47710891cfc4db9fa00beaa5ccd10113aa1c3 since the way to access the
first element in the message list and the API for get_old_messages
have changed since then.

(imported from commit f295f892bea9327eb8316225b7b98f0e3b3fdc9a)
2013-03-12 18:16:55 -04:00
Luke Faraone 10b15640e9 Highlight messages which contain your name.
This was requested by CUSTOMER18 and CUSTOMER4.

Closes trac #705.

(imported from commit a25c6b7ca0ae3ba89c03779b19c4d6b0af93a014)
2013-03-12 18:01:16 -04:00
Jeff Arnold e9cbae67b3 Make clicking notifications give focus to browser
Resolves Trac #1081

(imported from commit d5546ecda53a57b6dbbfc65db923432f8e4cc7b2)
2013-03-12 16:03:42 -04:00
Luke Faraone 3c95013a15 Iconify public/private streams on subs page and new stream modal
This will hopefully make stream privacy more noticeable. We still don't
allow people to modify privacy after stream creation, however.

Since we now use a radio box on the stream creation modal we had to change
the selector used by subs.js to determine if a new stream was to be invite-
only.

(imported from commit 641a4fab74301a9b3ecd4b3859f010dd4ece193e)
2013-03-12 15:14:29 -04:00
Zev Benjamin 26580f2399 Deduplicate messages from get_updates
This is a workaround for bug #1062.

(imported from commit 449b00e653829e263583376a88ae67b1fe4f5eb6)
2013-03-12 14:36:45 -04:00
Waseem Daher 33dc3a2fb7 Properly start tutorial on first run, even if you have new messages.
We were previously having an issue where the tutorial could
be pre-empted if you got a few messages while you were first
logging in.

I have some reservations about this being slightly fragile, and a
better approach might be to just have a bit that we use to determine
whether or not you've already seen a tutorial. (Or potentially that
checks whether or not you've ever sent a message.)

(imported from commit f8858f64a36bcd25887b76314caff283929f340c)
2013-03-12 09:56:57 -04:00
Waseem Daher dffde7714c Don't have the presence list occlude the "More messages" popup.
The issue, prior to this fix, is that the presence list actually
gets drawn *on top of* our "more messages" popup, which is ugly.

(Toggling the z-index on either or both of them did not seem
 necessarily to matter, but that's probably because z-index
 is subtler than I understand.)

This fixes Trac #1078.

(imported from commit a255aadb1884cf6c659085b26a36d378f680e83e)
2013-03-11 23:28:37 -04:00
Jessica McKellar 039178b12e tutorial: remove step telling you to colorize the tutorial stream.
We don't need it now that we auto-color.

(imported from commit 80066849b8f2aeef5e839f4fca40c9659b60a4af)
2013-03-11 16:47:04 -04:00
Jessica McKellar 2314809d73 Auto-color streams.
(imported from commit b669f864b0574e9e9af282ccb8783ccfaa12adfd)
2013-03-11 16:47:03 -04:00
Waseem Daher 436d3b2578 Don't open the composebox when you click on a Twitter avatar.
(imported from commit 9844d15a522d1b31a84aee15c9c0617951c53cc9)
2013-03-11 14:38:21 -04:00
Zev Benjamin 05d89139dc Use blueslip instead of throwing errors directly
(imported from commit 095ae006fd344943d7dc1c0bbc86f0ac0458e755)
2013-03-11 13:22:12 -04:00
Zev Benjamin dc0913077a Add a new frontend error-reporting system
The new system, called blueslip, makes errors fatal when in debug
mode and only output a message when running in production.  In the
future, it could also send user errors back to us automatically.

(imported from commit 1232607c0311e885c8b5a5e8a45ffb28822426e0)
2013-03-11 13:22:12 -04:00
Zev Benjamin 36f7e6ffd5 Remove verbose_stacktrace function. Use console.trace instead
console.trace is available in both Firefox and Chrome and is more
powerful.

(imported from commit fa6e2cd5c78e7b0588b8656270d078bfa6af41fa)
2013-03-11 13:22:12 -04:00
Zev Benjamin 9c28e52f91 Fix sort error for streams with names that are numeric
The jQuery .data() documentation says: "Every attempt is made to
convert the string to a JavaScript value (this includes booleans,
numbers, objects, arrays, and null) otherwise it is left as a
string. To retrieve the value's attribute as a string without any
attempt to convert it, use the attr() method."

(imported from commit f47c1cbb94cb5a98ea9842b00f45c35cd21873f9)
2013-03-11 13:00:01 -04:00
Zev Benjamin c50abd1c76 Fix jQuery selector exception from single quotes in stream names
Fixes #1065

(imported from commit 67f74e41f16c01d0d307bd8edf48dd70dde4edf4)
2013-03-11 12:38:15 -04:00
Waseem Daher 0e1b019f0a Allow Esc to blur the searchbox input.
This is a fix in response to an issue reported by Nelson.

(imported from commit 3db9e3a91d4e848408f19645e20382414a87b115)
2013-03-11 11:49:47 -04:00
Luke Faraone 8f52f8e4a2 Sort the streams sidebar the same way as the subscriptions page.
Closes trac #1050.

(imported from commit 8a6d5e067b7f726071e5797d70132cab689bbb49)
2013-03-11 11:44:06 -04:00
Tim Abbott 413a989058 Enable use_closest when moving pointer due to other clients.
Our mobile apps (which don't support in_home_view filtering) will move
the pointer to a message that isn't actually in the home view, so we
need to accept that sort of input for now (and maybe in general --
even if we fix our mobile apps, third-party clients may screw this up
too).

(imported from commit ce837e972f0581abd1df44fdb2dd5270dfb9afde)
2013-03-11 10:56:44 -04:00
Luke Faraone 93b4fcfeac Exclude humbuggers from the new stream modal
For people who aren't on the @humbughq.com realm the tutorial bot showed
up in the create new stream modal but attempting to invite them failed.

This was most often noticed with the tutorial bot.

In the future we should figure out a really good cross-realm story, but
in the near-term we need to probably exclude other people outside your
realm rather than special-casing @humbughq.com.

This closes trac #1059.

(imported from commit df704df0c8ae84b23d9491ce6ab77300831cdd20)
2013-03-07 16:58:29 -05:00
Waseem Daher a7495a8470 tutorial: Send an error message if the tutorial times out.
(imported from commit ae8b11f9b3d6e0480207492c4a3f64ac52b51367)
2013-03-07 16:52:52 -05:00
Waseem Daher 47da3b5229 tutorial: Get rid of unnecessary sleep.
We should start listening for the message right away,
not five seconds later.

(imported from commit 19de74e4dc309e81db56074bdc625aa76197b6ef)
2013-03-07 16:52:51 -05:00
Luke Faraone f73929c952 Update own name in sidebar when updating name globally.
We now add the my_fullname class to the entry for you in the sidebar so
that we can automatically update this element when changing your name.

This closes trac #979.

(imported from commit f1473d6bb6f18810311d42c85d4b57aab9966498)
2013-03-07 16:01:41 -05:00
Luke Faraone 34ecfb339f Add an alert to indicate bankruptcy is processing.
We also grey out the box to prevent the user from clicking twice.

This closes trac #1030.

(imported from commit eec810e3fbc5b7c9350c2d91e448fb27d4c856f8)
2013-03-07 15:50:16 -05:00