Commit Graph

91 Commits

Author SHA1 Message Date
krtkmj 734ab8d5e3 Correctly narrow to stream using search box from subscription page.
Fixes #1012.
2016-06-23 15:20:57 -07:00
Tim Abbott c35781d505 lint: Require folding of } on same line as else statements. 2016-06-09 14:02:49 -07:00
Vishnu Ks e329c9e0f5 Move maybe_scroll_to_selected to navigate.js. 2016-05-27 01:03:21 -07:00
Vishnu Ks fe4a03fd01 Move narrowed_msg_list to message_list.js. 2016-04-26 10:25:11 -07:00
Vishnu Ks ae49ad383d Rename all function on MessageList to all_messages. 2016-04-25 13:45:18 -07:00
Vishnu Ks 35b0af2852 Move all_msg_list to message_list.js. 2016-04-21 17:46:21 -07:00
Vishnu Ks ee39f5009f Make message_list.js work like the other modules. 2016-04-20 15:29:30 -07:00
Aristeidis Fkiaras 0058ccbdb0 Move global unread_messages_read_in_narrow to unread.js. 2016-04-08 12:11:47 -07:00
Liz Sander 860cf68716 Show current narrow in page title.
Fixes issue #157.
2015-12-14 21:21:30 -08:00
Steve Howell f8b71fa497 Created condense.js (with code taken from ui.js).
(imported from commit 72b27b48614a7c396170d46936646e52757e2743)
2014-03-14 20:48:58 -04:00
Leo Franchi 748e5b6da6 Remove disabled summarization code
This experiment has been disabled for everyone for a while: if we
bring something like this back, it is not likely to be exactly the same,
and will be different enough to require a different implementation.

As it is, the summarization code was making a few code paths (rendering
especially) more complex, and is worth removing for simplicity's sake.

(imported from commit 6ac8cdc9f7077a5a1da01ab4268aba3db0bc43f8)
2014-02-27 20:25:23 -05:00
Leo Franchi acec697fe7 Report unnarrow times as well as narrow times
(imported from commit b3a889aa11dc112508c5a1d213f68e5223a879fc)
2014-02-13 14:45:22 -05:00
Tim Abbott fcb8c106b1 Fix saving of pointer on server-initiated reload when narrowed.
Previously, we saved the current_msg_list selected id and then
restored it as the home_msg_list selected id, which could result in
the home view loading to the wrong place.

This takes some already bad code and makes it even more in need of
refactoring, but it does fix a pressing bug.  We should definitely
refactor both:

* the top of narrow.js
* the save/restore code in reload.js

after this, though.

(imported from commit bb2040219e4f545ba90bb04a696996cec2831484)
2014-02-12 14:40:38 -05:00
Steve Howell 10b24f77b6 Fix misc. uses of search tuples.
(imported from commit c7dc47c1396eb0d9f6821cafcb3dc90d283b4764)
2014-02-10 15:11:43 -05:00
Steve Howell 8d81ea33da Have pick_empty_narrow_banner() use operator/operand.
This is part of phasing out the internal tuple representation.

(imported from commit aa8788efbdc0f8d08d99bae154f68a3b60272c65)
2014-02-10 13:23:26 -05:00
Tim Abbott 02d69f18ac Clean up codepath for selecting a message on unnarrowing.
This does have a small functional change of using use_closest even for
the current_msg_list.last().id case, but that's harmless; and it does
reduce a lot of code duplication and confusing logic here.

(imported from commit 7c4ecaa197120cc6d5c05ce4887f33c7d94a9c59)
2014-02-06 10:25:35 -05:00
Jason Michalski 0dd61e9222 Blueslip has a warn not warning function
(imported from commit 1f18331cac451c62a089f042b316278030c41965)
2014-02-04 23:08:19 -05:00
Tim Abbott 0b12681558 Export message_store.get() for getting message objects.
(imported from commit d7d20bf3aab62a1b407709b1c0bf947b3ad8bee8)
2014-02-03 13:32:02 -05:00
Tim Abbott f26af47fb6 Center on-page-load narrows on first unread message.
This implementation is somewhat hackish in large part because I think
we're going to be wanting to redo the get_old_messages API somewhat
soon, and this may naturally become a lot cleaner as a result, but
this isn't a lot of code and fixes #2235 part (A) and substantially
mitigates #1510.

(imported from commit 47a2160a44befa9d83190c5cc95b90e92cc5b4cc)
2014-02-03 13:32:02 -05:00
Tim Abbott 88fbd5d16a Split out new module message_store.js.
(imported from commit 57cf3f2b8e74d7c56e3baf75859d5b3646282225)
2014-01-31 15:57:28 -05:00
Tim Abbott 004fd0eab8 Move unread-related functions from zulip.js to unread.js.
(imported from commit efc0dd84c2cd30b0203b906af6991475d8a63985)
2014-01-31 14:59:03 -05:00
Leo Franchi 01e948ac97 Allow unnarrowing to an empty message list in unread-messages-read case
(imported from commit f377dbce61fe2fc2051bc286f7215e8112f92736)
2014-01-30 18:08:48 -05:00
Steve Howell 15b0f9dcc7 Use operator/operand in narrow.collect_single().
(This is part of converting away from tuples.)

(imported from commit ba3083f8b3242fee1d532d7666aee68af89d8ddc)
2014-01-30 16:15:16 -05:00
Steve Howell 796ebfd007 Do not return raw operators from narrow.operators().
Even in the case where we are running embedded narrows,
we want narrow.operators() to return new-style operators
that you get with Filter objects, so that callees do
not need to support the legacy tuple format.

(imported from commit a6649881a926a2304e9f7cc8ca53b406e2c8828e)
2014-01-30 16:15:14 -05:00
Steve Howell b3a551f402 Stop using raw operators in narrow.activate().
Have narrow.activate() user filter.operators() to produce
operators that have operand/operator fields, so that its callees
don't need to be backward compatible with the tuple format.

(imported from commit e408e33074d1be2d112bb3cdc081ec3616c908ee)
2014-01-30 15:57:28 -05:00
Jason Michalski 21c2aea755 Fix scroll position on narrow and unnarrow
Change the offset to hold of the selected message as an offset from the
top of the screen. Then use the current offset and scrollTop to compute
the new scrollTop.

(imported from commit 718e95d3435c0f84cbb7663a9bb2bc2789314203)
2014-01-30 01:48:15 -05:00
Leo Franchi dd7d31c7a6 Allow an empty home view when unnarrowing
(imported from commit 69f1a84b23ae8942db58851a1a1c6723c26df560)
2014-01-28 15:35:31 -05:00
Leo Franchi 1fdb586c13 Make sure then_select_id is a number to call .toFixed()
(imported from commit 58635110c737ccb38e74cce8b4feb5d93dfbf5cc)
2014-01-27 12:30:42 -05:00
Leo Franchi 00f64113e9 Support locally echoing messages when sending
(imported from commit 00b5c5f9b933d119553c32cadff0f17b9f7c2879)
2014-01-23 16:28:55 -05:00
Leo Franchi 49c4ad61a1 Delay render on narrowing to end, to ensure only one render happens
(imported from commit c38574417e339275a90b235ecabc96e0deab95f8)
2014-01-23 13:29:18 -05:00
Leo Franchi 9160fb3ed5 Remove debug that slipped in to previous commit
(imported from commit 1aeb04b0e8fc0b37da4a8aa123b567d2f96cc32a)
2014-01-22 14:04:25 -05:00
Leo Franchi c0fdbf81cf Use the feedback connection for getting APNS feedback
(imported from commit d371188e0437606b3ff435ee9c005cee2849f6ae)
2014-01-22 13:50:15 -05:00
Tim Abbott 6443aead67 Fix scrolling when unnarrowing after reading new messages.
Our logic for unnarrowing when messages were read during the narrow
did not properly use the then_scroll option and thus actually set the
scroll position when they selected a new message.  This was
accidentally prevented from being a big problem by the incorrect
scrolling logic that was fixed by:

    Only preserve_pre_narrowing_screen_position when preserving pointer.

which caused the browser to scroll _back_ to close to the correct
scroll position (but not the intended scroll position -- it would
usually be a little bit off).

(imported from commit d779de8f89590d242f62d32b22a297bdc096c594)
2014-01-15 16:07:20 -05:00
Tim Abbott 86f9ea0cd2 Move save_narrow earlier in narrow.deactivate.
I think that this will fix the issues we've been having with
hashchange.save_narrow() screwing up the scroll position in the page.

(imported from commit 25af9b7dda2d107220e11dd12b9dc344bc63addc)
2014-01-15 16:07:17 -05:00
Tim Abbott 2632b130a5 Only preserve_pre_narrowing_screen_position when preserving pointer.
(imported from commit a0e323796f62b2bacd205a441ef68ac160918cdd)
2014-01-10 21:39:01 -05:00
Tim Abbott 795930c803 Add channel module wrapping our various JSON requests to the server.
(imported from commit 6489938678551ad8594822363ae6d1c9ae295496)
2013-12-19 16:52:47 -05:00
Tim Abbott 2276c6e524 Add support for loading a narrows-only embedded Zulip window.
Features:
* Only shows messages in the narrow
* New messages in the narrow will arrive as they are sent
* Works even for streams you're not subscribed to
* Automatically subscribes you to a stream on send
* Doesn't update your pointer
* All searches etc. automatically have the narrow added

(imported from commit 2e12b76849f6ca0f53dda5985dad477a04f7bbac)
2013-12-16 17:46:02 -05:00
Steve Howell e1727844d7 Only condense/collapse when messages are visible.
Trying to condense messages when they are not yet visible just
leads to wasted effort and wrong results.

This commit makes it so that current_msg_list always points to a
visible list, so the code related to message rendering knows when
to call ui.condense_and_collapse().  For activating narrows, we
now let rendering handle the condense/collapse case.

The home view situation is a little trickier, because we render
new messages in the home view even when we're inside inside of a narrow,
presumably to make it fast to switch into the home view.  When
we actually go back to the home view, we need to sweep for messages
that might need to be condensed, since they have been originally
rendered while the home view was not visible.

(imported from commit 4da2d278a4353e9e0c2b98cbf8c9dd03b06cd59b)
2013-12-12 15:38:38 -05:00
Jessica McKellar 81b493ba0b Change pointer semantic to better support side bar users.
There are now 2 cases for narrowing:

1. We narrowed, but only backwards in time (ie no unread were
read). In this case, try to go back to exactly where we were before
narrowing. This behavior is unchanged.

2. We read some unread messages in a narrow. Instead of going back to
where we were before the narrow, go to our first unread message (or
the bottom of the feed, if there are no unread messages). This is new.

This means that after catching up through the sidebar, on returning
home you'll be at the bottom of your feed.

Searching for the first unread message in a message list with 40,000
messages only takes 17ms according to:

function timeit() {
    var t0 = new Date().getTime();
    _.find(current_msg_list.all(), unread.message_unread);
    var t1 = new Date().getTime();
    console.log('Find first unread: ' + (t1 - t0) + ' ms');
}

(imported from commit 87c467578a2cced0aa976d8ae2924371b85d2445)
2013-12-09 10:41:26 -05:00
Jessica McKellar d4fae47430 Don't nudge pointer after unnarrowing.
This is in preparation for changing the pointer semantics later in the
branch.

(imported from commit 705ac2a48d7f36531d7683c5cf585cc89188a210)
2013-12-09 10:41:26 -05:00
Tim Abbott 458c066925 Add reporting for how long narrowing takes in the wild.
I'd also like to add a database table to actually store the values
that we get out of this and our send message requests for future
inspection, but for now, grepping logs+statsd is good enough.

(imported from commit 99ef179651850217fe6e82c5e928d122ca91101e)
2013-12-06 10:28:01 -05:00
Steve Howell f923c15ba8 Change signature of ui.process_condensing().
I renamed ui.process_condensing() to ui.condense_and_collapse(),
and, more importantly, it now takes a list of elements, not a single
element, which allows us to do some computations outside the loop.

(imported from commit d5984088030c2a0d4ec8b258c7fcec3e84caf2b1)
2013-12-05 16:42:07 -05:00
Jeff Arnold ec56e946a7 Only manually update fading if the compose box is staying open
(compose.start() and compose.cancel() both update the fading themselves)

(imported from commit 63ce2f54106c8cce2306b0c1f3ce56e06f24235f)
2013-12-03 16:58:50 -05:00
Tim Abbott ef906c3cd3 Fix traceback when unnarrowing before home message list has loaded.
If we load a browser window in a narrowed view and then un-narrow
before the home message list has loaded, we end up attempting to
select message ID -1 from home_msg_list even though it is empty,
triggering a traceback.

(imported from commit eb8b686f6e9c1fa518028e5755ac6196781e92d7)
2013-12-02 16:03:21 -05:00
Jeff Arnold 3a41184533 Revert "Make c/C compose to a new destination instead of being identical to r/R"
This reverts commit 755c92aed79ab79089b2e35d2c100582f012736a.

(imported from commit b7790fc63a2cea0a8e294c3f0a881ed6f06ed061)
2013-11-27 10:43:10 -05:00
Jeff Arnold c0a8fc459a Make c/C compose to a new destination instead of being identical to r/R
R means "I want to send a PM, you can guess the destination"
r means "I want send a stream message, you can guess the destination"
C means "I want to send a PM and specify the destination"
c means "I want to send a stream message and specify the destination"

(imported from commit 755c92aed79ab79089b2e35d2c100582f012736a)
2013-11-27 10:35:37 -05:00
Tim Abbott 8952d8d428 Add 'narrow to this conversation and time' narrowing.
(imported from commit 3bc5ea09d333c2caa37557419d54d48bbbb5a639)
2013-11-25 14:00:28 -05:00
Tim Abbott be2d546ffe Fix narrowing links in message popovers.
This should make it possible to either open these using middle-click
or copy the links for e.g. putting in a bug tracker ticket.

(imported from commit 0c531453cdd7197f932079c245700948b416a3d5)
2013-11-25 14:00:28 -05:00
Kevin Mehall e82f11ed46 Fix a JS error introduced by the debug logging.
Narrow.activate was called without an options object in one
obscure location. I'm not sure how it's actually triggered,
since all searches seem to go through the typeahead path with
the "Search for x" option, but someone managed to do it.

(imported from commit 5e0e1bbe7570e5f6a654949547dc164e01125efa)
2013-11-05 15:07:24 -05:00
acrefoot 9af244a6bc fix narrowing bug introduced by composebox notifications
I switched narrow.by_subject and narrow.by_recipient to use the all_msg_list
instead of current_msg_list, since we wanted to be able to narrow to messages
specifically not in the current_msg_list. However, in searches which revealed
old messages outside the range of all_msg_list (which only has a single contiguous range),
this broke narrowing.

Let's use msg_metadata_cache instead.

(imported from commit 427f717484b4ae83d9bb4cc6e51ce17177d037fe)
2013-11-01 18:33:10 -04:00