Commit Graph

81 Commits

Author SHA1 Message Date
Sampriti Panda e666a62c6a search: Extract 'Sent by me' suggestion logic into separate method.
This also adds a nice test suite for it.
2017-01-11 16:30:07 -08:00
Sampriti Panda c613e510ed search: Add autocomplete for 'from' operator.
Fixes #2932.
2017-01-11 16:29:58 -08:00
Tim Abbott 998dff9e50 lint: Add dangling commas in JavaScript objects. 2017-01-11 15:23:42 -08:00
kevv87 e6369fc29b eslint: change no-plusplus from warning to 2 and fix violations. 2016-12-01 14:27:17 -08:00
Steve Howell 06d7012113 Use people.get_all_persons() for search_suggestion.js.
This is better than using page_params.people_list, which may
go out of sync when live updates happen.
2016-11-01 13:55:48 -07:00
Steve Howell eb64b32bc8 Fix "subjects" in JS comments. Say "topics" instead. 2016-10-28 13:52:25 -07:00
Steve Howell 0a4579711d Add stream_data.get_recent_topics().
This removes the last remaining references to
stream_data.recent_subjects() outside of stream_data.js.
2016-10-28 13:52:25 -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 d30ea0bc44 Move recent_subjects to stream_data. 2016-06-07 17:50:16 -07:00
Steve Howell 89f10d7e7a Handle negated person-related operators in search suggestions.
(imported from commit e045a0910ff59d9b8569c5ba3b3b644fe2d7dad7)
2014-03-05 10:54:02 -05:00
Steve Howell e5e0ba9e7c Handle negated topics in search suggestions.
Typing "stream:foo -topic:b" leads to "stream:foo -topic:bar" properly
as a suggestion now.

(imported from commit bb0acf52744f7b13977a3db5d3c130d1402b09b7)
2014-03-05 10:54:02 -05:00
Steve Howell 44564274a1 Move methods from search_suggestion to filter.
The methods describe() and operator_to_prefix() are
now in filter.js.  They seem like they eventually
may be useful outside the scope of search suggestions,
and they seem to go hand in hand with other Filter
responsibilities.

(imported from commit 55f14c3ee848febb2e7c8c6a27afd690569b4e08)
2014-02-19 11:05:30 -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 fc78a2cc66 Stop using tuples in search_suggestions.js and Filter.unparse().
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)
2014-02-06 16:42:38 -05:00
Steve Howell 8f9d29189c Fix undefined operator in search suggestions.
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)
2014-01-21 17:07:50 -05:00
Steve Howell 01f141e2b6 Show more topics in search suggestions.
Search suggestions were limiting you to the last 10 topics
in a stream, not the last 10 *matching* topics in a stream.
This was just a bug, where the slice() call was supposed to
come after the filter() call.

(imported from commit 7ad8f8409315d8ca389aa5bb085275a60f6e08c0)
2013-11-25 16:26:22 -05:00
Leo Franchi 51e0bea608 Autocomplete emails in sender: completion
(imported from commit 44dc337842d46349b103cf9631faa7d439be682c)
2013-10-07 14:55:58 -04:00
Leo Franchi 33dacae82d Split calculating of prefix from narrow operators into function
(imported from commit 940d7d7290e0357aad300ea00b6fcc59cd56cae1)
2013-10-07 14:54:05 -04:00
Leo Franchi 41b286232d Allow filtering to alerted messages with is:alerted
(imported from commit 99834f1ee1b9b2e0f5c7427afa1494bf404e3626)
2013-09-05 10:18:41 -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
Zev Benjamin 2c775d0894 Make recent_subjects case-insensitive
(imported from commit 36c423f506c1e8dc0536c80a4a085b689623191a)
2013-08-20 15:37:08 -04:00
Steve Howell 9d145ef5d4 Use official stream name in topic suggestions
(imported from commit 68b63a31f6a6e3cf8de6fd7fc255137dbc3260b8)
2013-08-20 14:27:43 -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 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
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 71e138b1aa Suggest more topics.
Examine up to 300 topics for search suggestions.

(imported from commit 8d52dd4d857818dcf59222bfdd956ee800342894)
2013-08-08 14:53:11 -04:00
Steve Howell 0b4c37ef8d Autocomplete names w/spaces in search.
See trac #1356.

(imported from commit 6aaf122c0f6d7b1d92bb074e8f3fbb93d0b63ceb)
2013-08-08 12:54:20 -04:00
Steve Howell 3aa5930191 Streamline search suggestions when query has trailing space.
If you entered "stream:Denmark " in the search box, we would show
you two suggestions for "stream Denmark", despite our duplicate
detection, because we didn't canonicalize the suggestion that is
literally based off the user typed query, and so the other way
of generating the "stream Denmark" suggestion created a duplicate.

Now all the suggestions we generate are canonicalized, so the
generalized duplicate detection can work.

(imported from commit 52bf08ccf9bb2e2260ca8c20690169aead3732ab)
2013-08-06 14:04:29 -04:00
Tim Abbott c5b3cad534 Add the near and id search operators back to autocomplete.
These were accidentally lost in
53d08b29367c0172e483064f213538d45098279e.

(imported from commit 11813fd43b5ecb2e15ed9f3276497837b9997bee)
2013-08-05 17:59:05 -04:00
Steve Howell 1b1f80f3d7 Show "Home" less often as a search suggestion.
We now only suggest "Home" if you have an empty search box (suggestion #1),
or if you are typing "Home".  Before we'd show it as a way to get back
from various narrows.  This is trac #1596.

(imported from commit 9228bf45e9aaf9912d83efdf70338abb4b7e054f)
2013-08-05 15:56:12 -04:00
Steve Howell b33858dd70 Created search_suggestion.js.
Moved 400+ lines out of search.js into search_suggestion.js.  This
leaves search.js primarily responsible for lots of little DOM
interactions, whereas search_suggestion is more about data.

(imported from commit 53d08b29367c0172e483064f213538d45098279e)
2013-08-02 17:28:03 -04:00