This commit finishes up support for has:* searches by adding
the front-end pieces, specifically the part that "has" operators
will not be applied locally. It also implements basic
descriptions for search suggestions and canonicalization
of operands from plural to singular.
(imported from commit a3285bc33d06d76b5a2b403ebcdd911b4cc03980)
Typing "stream:foo -topic:b" leads to "stream:foo -topic:bar" properly
as a suggestion now.
(imported from commit bb0acf52744f7b13977a3db5d3c130d1402b09b7)
The match_subject and match_content template vars are notorious
for causing bugs due to the way handlebars forces the strange
../../.. syntax on us, so now we have some test coverage.
(imported from commit c6b151b964ae8b6fb199d9cdbe533a87c6b58947)
This helps the common case of not liking our default of having audible
and desktop notifications enabled, and not making users adjust the
settings on every existing stream to fix it.
(imported from commit be75edb2c1385d1bd9a289416e2dffd8007f5e0a)
As part of this, I also made test_basics() have a third
stream that makes false positives in the test less likely.
(imported from commit d5ba64ec9346741818e30abe9e9594788c339fab)
Now that we no longer use tables for our message list, we can
more logically group messages together.
(imported from commit 9923a092f91a45fe3ef06f2f00e23e4e3fb62a37)
This changes Filter.describe and Filter.operator_to_prefix
to handle negated terms correctly.
(imported from commit 673c0d3a5a77784e95772c14e12534ad2daecda2)
Commit "ecf0eb85 Redesign styles for message pane" removed the
right_part class, updates the tests to not use it.
(imported from commit 277eb3748913895b13ab7bdca11e668033c9f9b3)
Remove the options to narrow by topic/person from the menu,
because there are better ways to do this in the UI, and
remove the time travel option, because the "Link to this
conversation" achieves mostly the same effect.
(imported from commit b7e0cfe64c0760e5a7bf7a8c9c05ed1a5b747300)
For the Filter helper functions above, we generally want to
ignore negated search terms, since their existence should
really only impact filter predicates and nothing else on the
JS side. The exception is search, where even the existence
of a negated search needs to be noted to know that we can't
apply a filter locally.
(imported from commit 8bbb410a85fefed549d359e4c779a134ad830c11)
For negated search terms, we weren't explicitly setting
"negated" to false when callers left it undefined, which was
mostly fine, since undefined is falsey, but it is better to
define it explicitly for debugging/testing purposes.
(imported from commit 68a2790b510d17caed8ca11c38188545d1dcc347)
Behind a feature flag you can now do searches like this:
-pm-with:othello@example.com is:private
The "-" in front of "pm-with" tells us to exclude messages
with Othello from our search. We support "-" in front of
all operators, although the behavior for "-search:" and
and "-near:" doesn't really change in this commit.
Note that the filtering out of "negated" predicates only
happens on the client side in this commit. On the server
side we ignore negated predicates and send back a superset
of the results.
(imported from commit 6cdeaf32f2d493fbbb838630f0da3da880b1ca18)
This this removed one forced relayout of the page on unnarrow. This
saves about 100ms for me.
(imported from commit 0755f425abbe3d99b8a99765549a5bbf3c620b9a)
The filter_term() function was supporting the transition
from using tuples for search terms to using dictionaries,
but now all of the JS code should be dictionary-compatible.
(We had already abandoned the tuples safety net on staging,
and a couple days of use have given me confidence we can
pull the shim code.)
The one side effect this change has is that search terms will be
initialized to {} instead of []. This distinction matters
when it comes to calling JSON.stringify on the search terms.
(imported from commit 1fbe11011d8953dbea28c0657cbf88384d343e00)
When we typed "stream:" into the search bar, the empty operand
triggered an error in the Dict class for an undefined key, because
we were using opts[0] as a "defensive" workaround to opts.operand,
but opts.operand of '' is more correct than opts[0] being undefined.
Now we only fall back to opts[0] whe opts.operand is undefined, and
we emit a blueslip error when that happens.
(imported from commit 88a196d3bc3d67689c36bc036f378da744c652f9)
We have shim code that makes our internal narrow operators
support both a tuple interface and an object interface. We
are removing the shim on staging to help expose any dark
corners of the code that still rely on operators being
represented as tuples.
(imported from commit f9d101dbb7f49a4abec14806734b9c86bd93c4e1)
This is yet another change related to phasing out the
[operator, operand] tuple data structure for representing
terms in a narrow.
(imported from commit 508e58fc4eebae8a24a8ae59919ba5d94fc66850)
The JS code can now call stream_data.get_sub_by_id() to get
a sub from a stream_id. Subs have stream_id due to a prior commit,
and we keep track of the mapping in stream_data's subs_by_stream_id
variable.
(imported from commit 409e13d6d2e79d909441a66c85ee651529d15cd2)
The tutorial introduces "engineering" messages that might not
be in the user's normal subscription, and they would get a gray
border if we did not override the stream color. Before this change,
we accomplished this by overriding the core data structure in
stream_data.js. Now we are a bit more future-proof; we only
override stream_color.default_color.
(imported from commit 0d0845b72f766912679f5aa7641ae9a60fdbb4ce)
Add try/catch blocks to get_updates_success and send a blueslip error on
errors we catch. This will let get_updates_success return successfully
so that the next call to get_updates will start immediately.
(imported from commit 44d8b85d9d8e930a5552a5fbf4af1d0e5e8c07e8)
Add a helper to patch_global to change a global and then reset it to the
original value after a test file is complete.
(imported from commit 1b65ff6ea8693ad61b7f18f35dafa942429252a8)
In the early days of the node tests we didn't have an index.js
driver, so each test set it up its own environment. That ship
has long since sailed, so now we just require assert in index.js
as a global and make it so that the linter doesn't complain.
(imported from commit 1ded3d330ff40603cf4dd7c5578f6a47088d7cc8)
Having to explicitly call out the underscore/Dict dependencies
in nearly every test has proven to be more cumbersome than helpful.
We never monkeypatch those modules in the tests.
(imported from commit 49ef70c835edd4e22a5869eda9235ef3ffc3c59b)
If you do a search like id:5 topic:foo and message #5
does not have the topic "foo", we now return zero results.
(imported from commit 8121fac1dbd79024c51af1f310d831dab9242e36)
By having Filter.canonicalize_tuple() call filter_term(),
we make it so that Filter objects get operator/operand
fields in their terms when we initialize this.
This mostly caused test breakage for tests that were doing
assert.deepEqual; now we just check to make sure that the
field we need are there.
(imported from commit 63b2516dc72edeb11e76a1fa4442570b9c605baa)
Consumers of Filter.parse() can now reference
search term parts like so: term.operand, term.operator
(Legacy code can still use term[0] and term[1].)
(imported from commit 06d0da65f13f1eb7e3ba8eac0e69448aab2735ab)
Previously, while you'd get the event saying you'd been knighted,
which would make the Administration tab visible, clicking on the tab
would error out because the admin page HTML was never sent over on
page load (since you weren't an admin at that point).
(imported from commit 90ad351533515bebece630d67baf4b142d320754)
Add javascript to handle the button clicks and update the status based
on the subscribe and unsubscribe events from the server.
(imported from commit 6b9c0b40d9084e3d8b64bed701ebc786bef6d432)
There was a bug where you would type "is:private je" into the search
suggestion and see undefined:jesstess@zulip.com. Now we use
the "pm-with" operator. The search suggestions for people are kind
of complicated now, because there is some overlap between
get_private_suggestions and get_person_suggestions.
(imported from commit 7d330f34f4a433995420de6eb90cb41229b70272)
This function can redraws the lock icon (or lack of lock icon)
for a stream in the stream sidebar. It can be called when
admins change the stream privacy.
(imported from commit 880133d02525137094c48ecad8cf2dfff59f3307)
This is a node test that verifies that
stream_list.add_stream_to_sidebar() creates the right
DOM when it renders the stream_sidebar_row template.
The test also makes sure that the DOM gets put in the
correct place to be retrieved by stream_list.get_stream_li()
calls.
(imported from commit ed4c0148da2261870e3db5a9b553913788b4eccd)
The node tests will now throw an exception if you haven't
at least compiled one of the handlebars templates as part
or running template.js. This includes a one-line fix to
include tutorial_welcome.handlebars.
(imported from commit 51b4cae293d54c1f374a84623b4928519775e228)
expected_messages was ltriming headings but we had a newline at the end
innerText. The ltrim was changed to a trim to correct this.
(imported from commit 5e411c5fc46a2cb675c1268041e95bbb2522c8f9)