Commit Graph

300 Commits

Author SHA1 Message Date
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
acrefoot 434b7ac120 Give Feedback in non-obvious cases for sent messages
Displays a notification above the composebox in cases where the message
is not visible (further down), or where it's outside the current narrow or search.

It also offers a link to the appropriate narrow when it makes sense, and offers
timetravel when appropriate. There is currently a bug with timetravel (and you can
see this when using the popover menu) that makes "narrow to messages around this time"
not work for muted messages.

This resolves Trac #1518.

(imported from commit 391ca0b9c07d91496f6585a4fd8e15723d1170e2)
2013-11-01 12:34:39 -04:00
Kevin Mehall 58f7138e07 Collect additional debug information for JS errors
(imported from commit 7c94ad118c2cd33e5b6eec4e27fd22dfa2d56909)
2013-10-31 13:18:43 -04:00
Zev Benjamin eb7fd1ba51 Add some front-end debugging changes
(imported from commit 21684b09100bc0a24372948a9417c973709c1be2)
2013-10-30 15:52:35 -04:00
Kevin Mehall 463b10cf0e Enable summarization only for the right narrows.
* Disable for search-like narrows (whitelist stream and home instead of
    blacklisting topics and PMs)
  * Use home view summarization flag for All Messages

(imported from commit 48bd10ae5da7c7564c2efe86a40078f1a7e96e20)
2013-10-21 11:48:56 -04:00
Steve Howell 0ad4554723 Allow customer12.invalid users to narrow to a single message.
Add the option "Narrow to just this message" to the chevron
menu.  This has two use cases:

    * It's an easy way to get a sharable URL for the message.
    * It reduces distractions.

For now it is feature flagged to just customer12.invalid and staging.
See #1880.

(imported from commit 897d247176f9024ff825ccd3b338236569eed5ab)
2013-10-11 15:52:10 -04:00
Steve Howell 89cbda5001 Keep in-progress compose open on narrows.
If the user has text in the compose box, don't close or
change the compose box when they narrow.

(imported from commit f9b400f6bac37cb313f1fd87aadb3ba1d3a035ef)
2013-10-10 11:20:49 -04:00
Steve Howell 8017fc9a15 Move compose.start() calls out of click handlers.
For the two cases where narrowing should open the compose box,
we now put that logic inside of narrow.js.

(imported from commit 570e22e90c2f6d422ba71cce400c075f0b8adf51)
2013-10-10 11:20:49 -04:00
Steve Howell 7007cf203d Move compose.cancel() calls out of click handlers.
Handle closing the compose box inside of narrow.js, to
ensure consistent behavior for all the narrowing UI options.

(imported from commit f17a687491eb2361c73032cd974cedb2a0a2dd85)
2013-10-10 11:20:49 -04:00
Steve Howell a78a1ec36c Use <a> tags for links in the recipient/summary bars.
The main user-facing feature here is that users can open narrows
in new tabs or windows. Internally, it makes the HTML more semantic.

One consequence of making these elements into actual anchor tags
is that clicking on them no longer triggers this logic to
close the compose box when you click outside of it:

        // Unfocus our compose area if we click out of it. Don't let exits out
        // of modals or selecting text (for copy+paste) trigger cancelling.
        if (compose.composing() && !$(e.target).is("a") &&
            ($(e.target).closest(".modal").length === 0) &&
            window.getSelection().toString() === "") {
            compose.cancel();
        }

Instead of patching the above code, I elected to just call
compose.cancel() explicitly in the click handlers for the links
themselves.

We are gonna try to clean up the compose-box behavior globally soon.

(imported from commit c9a01916f1714fe3dd495d25c78cd5e5532105ef)
2013-10-09 17:09:10 -04:00
Steve Howell 6c6816491d Add muting_enabled option to MessageList.
(imported from commit c86772b7dea864c49091c988772e17aae5efa5bc)
2013-09-23 10:53:06 -04:00
Steve Howell 022ef6e9b9 Add narrow.muting_enabled()
(imported from commit 8972d1e3ca347397664094a7f150ec86fd2f8f8e)
2013-09-23 10:53:06 -04:00
Steve Howell e79e74ade4 Add narrowed_to_topic() helper function.
(imported from commit 9190caa9b183893fb7ae883686b9bdbd661d5895)
2013-09-19 15:41:00 -04:00
Steve Howell c4d598b36e Move parse/unparse from narrow to Filter.
I'm trying to move well-isolated methods out of narrow.js, so that
narrow.js is more strongly focused on UI/ajax interactions and
big, heavy lifting stuff.  The logical home for parse/unparse
seemed to be Filter, and they brought along two private methods
with them.  The big code moves involved trivial follow ups
like s/exports/Filter/.

(imported from commit ace0fe5aa1c7abce0334d079ba9eb8d9a57bd10f)
2013-08-22 14:53:00 -04:00
Steve Howell edda967100 Leave casing alone in search suggestions.
The function narrow.unparse() is used in a bunch of places in
the search suggestion code, and now it no longer lower cases
operands.  This change contributes to fixing trac #1659.

(imported from commit 6b44b8a818482b5c8b4f9a45bc7d3a9d21e04eba)
2013-08-20 14:27:44 -04:00
Steve Howell d5f997eb58 Use the correct stream name in compose defaults.
If we have a stream named "Denmark" and we're narrowed to it,
then use "Denmark" as the default stream name in the compose box
even if the narrow operators are lowercase.

(imported from commit e9f06b7307c73231aa887dc95849e0307984e6f0)
2013-08-20 14:27:42 -04:00
Steve Howell 29c012dc74 Create stream_data.js module.
This pulls a lot of data-centric functions out of subs.js.

(imported from commit 0deed7d4bf5697e893af9bc9d888c2d5da8d9fa2)
2013-08-19 12:17:55 -04:00
Steve Howell 75ffd4d637 Exempt last 5 messages in view from summarization.
Once you enter a view, the last n messages will be exempt from
summarization, to give the users a little more context.  Any
subsequently arriving messages will also be exempt.

We will try n=5 at first.

(imported from commit 3e6fe58109e692389bf02dde2230d788b5818d52)
2013-08-15 08:20:29 -04:00
Kevin Mehall 0f6c7ca7be Use msg_list.get_row(id) instead of rows.get(id, msg_list.table_name)
(imported from commit 953cd24e605269d2bbdc42b878506f0ab01501e8)
2013-08-14 17:08:32 -04:00
Steve Howell 878ee2b3fd Move Filter class to filter.js from narrow.js.
1) The class Filter now lives in its own module.
2) The function canonicalized_operators() is now a class method on Filter.
3) The function message_in_home moved to filter.js and became private.
4) Various calling code had to change, of course.
5) Splitting out Filter helped simplify a few tests.

(imported from commit e41d792b46d3d6a30d3bd03db0419f129d0a2a7b)
2013-08-12 13:58:32 -04:00
Steve Howell c4e168254c Fix too-much-fading regression and remove spurious classes.
To get to the bottom of the too-much-fading regression,
it was necessary to clean up the code, which was overly
complicated by multi-purposed functions.

The API for compose_fade now has these functions:

    set_focused_recipient
    start_compose
    clear_compose
    update_message_list
    update_faded_messages

Internally there is now a notion of "normal display",
so e.g. when you want a normal display, we call
_diplay_messages_normally() internally, which removes the
faded/unfaded classes from all messages.

(imported from commit 7eb2b0a163f29d9ebae26661f432fecc7c331e4c)
2013-08-12 11:54:27 -04:00
Steve Howell 37f8cc9294 Extracted code into compose_fade.js.
The compose_fade has three public exports:

    set_focused_recipient
    unfade_messages
    update_faded_messages

All code was pulled directly from compose.js, except for the
one-line setter of set_focused_recipient.  The focused_recipients
variable that used to be in compose.js was moved to compose_fade.js,
hence the need for the setter.

(imported from commit 462ca5d0d0bd58612d0197f3734a8c78de8c6d30)
2013-08-11 17:05:13 -04:00
Zev Benjamin 222f6194e2 Fix key lookup when canonicalizing operators
(imported from commit 59d460bfaa50c0872918d1e5a22efb98d15ce669)
2013-08-09 17:35:58 -04:00
Zev Benjamin ec9322fc87 Use Dict everywhere we have keys based on potentially dangerous, user-supplied data
There are also one or two places we don't need to use it for security
purposes, but we do so for consistencey.

(imported from commit aa111f5a22a0e8597ec3cf8504adae66d5fb6768)
2013-08-09 17:35:14 -04:00
Steve Howell cc73619a9d Add unit tests to narrow.js.
This includes slightly invasive, but harmless, changes to
production code.

(imported from commit 847557c11088b75c836cc399d0af75353a8faa3a)
2013-08-09 11:59:32 -04:00
Kevin Mehall 2664002dec Make summary rows selectable.
We represent summary rows by the ID of their first message for
for selection purposes.

(imported from commit 9f3c4d23f6b1295b117d5197e214de983bb2cc20)
2013-08-08 13:04:01 -04:00
Kevin Mehall eac6463031 Implement message summarization experiment.
When you read messages in a narrow and then un-narrow, collapse
adjacent messages read in the narrow into a summary row that can
be clicked to expand those messages.

Scoped to staging with feature flags.

The implementation of this within our current MessageList is rather ugly.

(imported from commit bcb3a39d8c0c334136fe86318f18ead03f0f50bf)
2013-08-07 10:24:03 -04:00
Steve Howell 01b40f3c98 Fix compose/topic regression (trac #1648).
When you are narrowed and hit "New stream message", the topic
will autofill.  This broke during the subject-to-topic
transition.

(imported from commit a9b471884c5cdae449e02ce7aa782add4a178077)
2013-08-05 17:58:45 -04:00
Tim Abbott 5a320db3c1 Add curly braces for all javascript if statements lacking them.
(imported from commit 32c7643d1a6ecdfaf634424d217938c8a368dade)
2013-08-01 11:47:54 -04:00
Scott Feeney 1e642ae158 Use _.any instead of _.some
They are synonyms, and Zukeeper consensus is that _.any makes it clearer
what the function does.

(imported from commit 847383e27ccefeaff1ecff15f4cb4177c9e40c25)
2013-08-01 10:16:32 -04:00
Zev Benjamin 905354f7a1 For mit.edu, include .d instances in narrowed views
(imported from commit 502b36d1a62f3f8f7b956c701fd10f580e1927d7)
2013-07-31 18:30:28 -04:00
Zev Benjamin bae5924b53 Fix whitespace
(imported from commit 96937f8225bc7039f2a98163deb9b5b142c71c7f)
2013-07-31 18:30:28 -04:00
Zev Benjamin a637fadd18 Fix regexes for MIT narrows that include un- and -.d streams
The previous regex didn't escape the period in '.d' and was doing a
case-sensitive match to find the base stream name.

(imported from commit 43ef13733987e50dcead06b7bd3e768cb4395998)
2013-07-31 18:30:28 -04:00
Tim Abbott d6acd8fce9 Add support for narrowing to a single message ID.
This is mostly useful for sending someone a link to a single Humbug
message.

(imported from commit b0994a2bf503c84690b13ce89bbcf5bab829bf0c)
2013-07-31 14:59:05 -04:00
Tim Abbott ed6f5ac470 Fix time travel by adding new near: operator.
(imported from commit 727a68016090164b586cbe59e692676a00e8cd3a)
2013-07-31 14:59:01 -04:00
Scott Feeney 473a96fd1f Fix #1629 (wrong scroll pos on narrow)
(imported from commit ac78077f104b079406e745c3eb9ff11b759d033e)
2013-07-31 14:35:48 -04:00
Scott Feeney a35fff90cc Replace $.extend
(imported from commit 2c1ee3c2714d388f2a71398fe81c049cc54ff94d)
2013-07-30 12:12:59 -04:00
Scott Feeney 8703134a23 Replace $.each with _.each
In a few cases the $.each was doing something imperatively that was
terser and easier to understand by using a different Underscore method,
so a few of these I rewrote.

Some code was using the fact that jQuery sets `this` in the callback to
be the item; I rewrote those to use an explicit parameter.

Some code was using $(some selector).each(callback). I converted these
to _.each($(some selector), callback).

One function, ui.process_condensing, was written to be a jQuery $.each
callback despite being in a totally different module from code using it.
I noticed this and updated the function's args.

(imported from commit bf5922a35f257c168cc09ec1d077415d6ef19a03)
2013-07-30 12:12:58 -04:00
Scott Feeney 375b1f9eb3 Replace $.map with _.map
(imported from commit 97c7a6612d8d56d19f8650db0ea8906afc0f20ef)
2013-07-30 12:09:18 -04:00
Steve Howell 6cf5b64b3c Update module.exports for various modules.
(This makes them play nice with node-style unit tests.)

(imported from commit 44fa97c9d38d0b7e82366b49db1425508b6aed67)
2013-07-30 08:54:23 -04:00
Tim Abbott bc4d7c687d Rename our custom JS events to use Zulip, not Zephyr.
(imported from commit 61ac456d394a6dbc14f3e9183a53313990db5059)
2013-07-29 12:11:26 -04:00
Tim Abbott 3bba0cc927 Move zephyr/static to just static.
It's not really a part of the server (aka the rest of zephyr/).

(imported from commit 27f6b6b064938ad927075a68d873e4b68710d279)
2013-07-29 12:11:26 -04:00