Commit Graph

187 Commits

Author SHA1 Message Date
Tim Abbott 227995e971 narrow: Don't crash computing then_select_offset for offscreen then_select_id.
Unlike the other cases where we do this sort of offset calculation,
we're working with a message which is not msg_list.selected_id() --
which means that this message might not actually be rendered at all.
Correct for this by just letting then_select_offset stay undefined in
that case.

(imported from commit ebb8a23bf34c52f9495aa88ceca8eb4458d50be1)
2013-07-10 13:21:08 -04:00
Steve Howell 1edd9a1d9f Fix scroll-to-the-middle bug.
(imported from commit dcd102541c8ee2b341060def714c24b05f2db514)
2013-07-08 23:11:09 -04:00
Steve Howell f87b27a9c3 Bold @-mentions link when you click on it.
This fix also cleans up the search operators so that @-mentions
and Private messages have a more similar naming convention.

(imported from commit fb1a2119aab5aa9e179c6e321a8d2ef2e90290cf)
2013-07-08 22:04:28 -04:00
Tim Abbott 166a9c9635 Return the viewport to a corresponding position when unnarrowing.
(imported from commit d1cb35b175a23e18ed79537843ce7940ec370cf3)
2013-07-08 17:32:18 -04:00
Tim Abbott 0d5469f6ab Preserve the location of the selected message when narrowing.
(imported from commit 38230a79d3bb2c403e20ed9b40b04731c0312325)
2013-07-08 17:32:18 -04:00
Steve Howell a90a155e03 Make narrow.by_recipient 'read' a message.
(imported from commit aadefa6be8f04a033d278050eb1d5135d5b1bdc5)
2013-07-08 17:12:32 -04:00
Steve Howell 0908f15109 Make narrow.by_subject 'read' its message.
(imported from commit e81140c440fecd283443eab46f0c65faffee8df1)
2013-07-08 17:12:32 -04:00
Steve Howell 249252f700 Put spaces after "function" in JS code (cosmetic).
(imported from commit 7579547bfed70b3e53122109d0d6f30ea01f5ac3)
2013-07-05 16:32:32 -04:00
Tim Abbott 20c1e1bb8c Fix regexp for mit.edu on javascript side as well.
(imported from commit cf1bf6c78b7116a49436fe0de98abc4aad74e611)
2013-07-03 18:39:44 -04:00
Kevin Mehall 5999df005e Wrap option lists onto multiple lines where previous commits made them long
(imported from commit 856bd9f0082ef1a6e8d537316330c40266f2f25c)
2013-07-03 17:10:15 -04:00
Kevin Mehall 56bd11fa7f Don't mark messages read when the pointer lands on them when narrowing.
This is slightly inconsistent, but keeps the unread count from decreasing
when narrowing and un-narrowing.

(imported from commit 185e8653c31a312c166e784b335ae7ae7e9b78e9)
2013-07-03 17:10:15 -04:00
Jeff Arnold 45116a0b61 For mit.edu, include unclasses and .d classes in narrowed views
(imported from commit e21aab715c949d4348c447e6e135281b47e06b98)
2013-07-02 10:50:29 -04:00
Tim Abbott c824901e2e Load fewer messages from the server when narrowing.
This should substantially improve narrowing performance, while still
delivering enough messages that one should only need to contact the
server again if the user scrolls up a significant distance.

(imported from commit 2b0af0e5b9d3a449e7f195a87d57d517b47f0b3a)
2013-06-17 13:48:06 -04:00
Tim Abbott 8678148ad1 narrow: Simplify narrow operand processing code.
(imported from commit 9b353c3fab0d5c6532e844c9de45f10a7c6dc068)
2013-06-14 10:45:05 -04:00
Tim Abbott 6f57f62866 Convert tab_bar.js to not make positional assumptions about operators.
(imported from commit 4ae492951ec21b034b64be1296215862b25e44bd)
2013-06-14 10:45:05 -04:00
Tim Abbott 7642b5bf30 narrow: Fix positional assumptions about order of narrow operators.
This cleans up most of our blocks of code that assume in any narrow
that the only operators present are the ones of interest and that they
always appear in the expected order.

(imported from commit 038707aefbe125b0c14f823fa93472fd40302e20)
2013-06-14 10:45:05 -04:00
Leo Franchi 969e0dd827 Clean up subs.have by splitting it into logical pieces
(imported from commit 0fe55aa62ccc95cae5c9aba565b0e4c04692fb46)
2013-06-13 10:06:34 -04:00
Jessica McKellar b895780c7c Make narrow.operators always return an array.
Previously it could return an array or boolean, and this inconsistent
interface had several latent bugs where consumers of the API only
considered it returning one or the other type.

This also fixes a specific bug a user triggered by being narrowed to
nothing (/#narrow) and clicking in the compose box.

(imported from commit 64ca2a37a9f288066f89b0ddec6638e010704eb0)
2013-05-31 13:51:53 -04:00
acrefoot 6ae117ea5f Re-focus on the compose box after a send, auto-move cursor
Re-focuses on the compose box after a send, under these conditions:
1) narrowed to stream+subject -or- responding to PM/huddle
2) compose was initiated by clicking on a message or hitting "r"/"enter"
3) cursor has not moved since you've started the composition

Additionally, if you are thus narrowed, we will move your cursor when you've sent
a message to that message, assuming that such a message initially appears visible.

(imported from commit 373c858081694e6fc9994639340a847d66edb566)
2013-05-31 13:43:05 -04:00
Leo Franchi 0524c14c8c Ignore leading spaces in search box
(imported from commit 098a8f288c8264cc804b737f804b866c64c0ff5b)
2013-05-31 12:24:30 -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
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
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
Zev Benjamin d35c8f0c81 Track what user action triggered a narrow
(imported from commit 2b110dc27334e4b823810bfef13c3d10d36b3886)
2013-05-21 17:56:49 -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
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
Zev Benjamin 60e479bdf1 search: Parse quoted strings as single tokens
(imported from commit 252f2657881ad4184a2564d16bf11558613efead)
2013-05-17 01:02:34 -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 43829b4288 Fire an event on narrow and unnarrow
(imported from commit f3e5e5435ea425c4d3887b43824e53a1c817fa6f)
2013-05-07 11:47:13 -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
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
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
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
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
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 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 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 ca4baa01e0 load_old_messages: Clean up for_narrow parameter.
(imported from commit 1be9959ec3998371f24f9d11a9aa87e59d85aabf)
2013-04-12 15:43:41 -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
Zev Benjamin 9d1548fe08 Add empty feed notices for private messages
(imported from commit e4067336f6b2e9e82b794599d30dfc3825852652)
2013-04-04 11:36:51 -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
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