* 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)
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)
If the user has text in the compose box, don't close or
change the compose box when they narrow.
(imported from commit f9b400f6bac37cb313f1fd87aadb3ba1d3a035ef)
For the two cases where narrowing should open the compose box,
we now put that logic inside of narrow.js.
(imported from commit 570e22e90c2f6d422ba71cce400c075f0b8adf51)
Handle closing the compose box inside of narrow.js, to
ensure consistent behavior for all the narrowing UI options.
(imported from commit f17a687491eb2361c73032cd974cedb2a0a2dd85)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
They are synonyms, and Zukeeper consensus is that _.any makes it clearer
what the function does.
(imported from commit 847383e27ccefeaff1ecff15f4cb4177c9e40c25)
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)
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)