Commit Graph

28 Commits

Author SHA1 Message Date
Zev Benjamin d35c8f0c81 Track what user action triggered a narrow
(imported from commit 2b110dc27334e4b823810bfef13c3d10d36b3886)
2013-05-21 17:56:49 -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
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 e7d04ff60f Fix encoding of narrows with '.' in the URIs.
(imported from commit fa624c0f810817b8093aeb4e3fb4329cad4cf9fb)
2013-05-02 15:35:45 -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 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 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 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
Zev Benjamin a6058c40ad Wrap hashchange event handler with blueslip wrapper
(imported from commit 96ed0681964d36e13878e09a3f58a65c5a993aa0)
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
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 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
Zev Benjamin 48e7fed00f Fix the selected message when narrowing to a stream that has no messages loaded
We would previously scroll you to the top of the just-loaded block of
messages

(imported from commit 520e5588aa078313649677663c7feea4ca1d7145)
2013-02-21 13:29:17 -05:00
Zev Benjamin e9b915c2b9 Remove global selected_message_id and persistent_message_id variables
Each message list now has a selected message id.

(imported from commit 041abc54ea42c636c30e39df4a2e838bb830e1aa)
2013-02-21 13:29:17 -05:00
Zev Benjamin 97160d79d4 Use the new MessageList for storing messages
(imported from commit 38a04d2ff504aa49189997b972318af7c944d528)
2013-02-21 13:28:23 -05:00
Zev Benjamin e19f9fd3d0 Also restore the scrollTop when the hash changes to '#'
(imported from commit 7b93c4692cca0a6e12b8e01560be7ae00240fa39)
2013-02-21 13:25:29 -05:00
Waseem Daher e3e8d9b939 Revert recent set of floating_recipient_bar changes.
We suspect that these seem to be causing a regression where scrolling
in narrowed views gets really sluggish, but we haven't totally been
able to figure out why since it's challenging to reproduce locally.
(It currently manifests itself on staging but not prod.)

So for now we'll back them out. Here's the full set of things:
Revert "Cause update_floating_recipient_bar to get called less frequently."
This reverts commit a6c1518c4001a2dde44d7b512236795da3ccd351.

Revert "Remove double-scroll in un-narrowing code."
This reverts commit 3dde6c27ffa1e8afa1a084b1b2baee3bc0512962.

Revert "Reset our scroll position if we change our hash to "#"."
This reverts commit 925b44d770c96dafaabebc9e0114f9a3b8f53c4d.

Revert "Properly update floating subject bar when you are at top of page."
This reverts commit 6633cc8a81aedcbb31b30d7c1f27816f8808c700.

(imported from commit a273730581cef30c33bedf701659ee084434f8ad)
2013-01-11 10:58:04 -05:00
Waseem Daher a9112155da Reset our scroll position if we change our hash to "#".
Changing the hash to "#" causes Chrome to jump to the top of the page
on Mac OS X. This commit doesn't actually fix any bug, but it
is necessary for my *next* commit, where otherwise you'd have to
ensure that the scroll code came *after* the hashchange code.

(imported from commit 925b44d770c96dafaabebc9e0114f9a3b8f53c4d)
2013-01-10 11:37:44 -05:00
Keegan McAllister 5ee6a9ebca Rename narrow.show_all_messages to narrow.deactivate
(imported from commit 927374756e112abc1042b16caa315af8c1f0baec)
2013-01-08 12:18:29 -05:00
Keegan McAllister 3c9b9227f8 Get rid of the narrowbar
(imported from commit 53335b8177561d4b103659a51704d6b2ce7ec367)
2013-01-08 12:18:29 -05:00
Keegan McAllister 38ff2d9993 Use operators to express narrowing internally
This breaks server-side filtering, for the time being.

(imported from commit 58ec2d7aa593e1c71f835b186535a038faa63239)
2013-01-08 12:18:29 -05:00
Jeff Arnold ff57c9af59 Immediately load_old_messages when the user arrives via a #narrow URL
(imported from commit 9705cbb70f9ce62ea5e362212ac91daf1b97ff13)
2012-12-21 12:13:42 -05:00
Jeff Arnold 4feae6b202 Make the back button work for the settings and subscriptions pages
(imported from commit 650c884abc9514cdfc934ae01e0a490f5f681292)
2012-12-20 14:45:11 -05:00
Jeff Arnold f4ddf4412b Make it possible to paste a #narrow URL into a new tab
(imported from commit 0a2ac3e7100627fd02874b02c1b5abe6d4b58c77)
2012-12-20 14:45:11 -05:00
Jeff Arnold db6f03d46d Make the back button work when narrowed
(imported from commit be922b06e7b53ec21751e67a490bb518333c3e6c)
2012-12-19 14:46:31 -05:00