Commit Graph

1521 Commits

Author SHA1 Message Date
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