Commit Graph

1724 Commits

Author SHA1 Message Date
Steve Howell 8deb2fc9ef toggler: Always call back to callback function.
In our toggler component (the thing that handles tabs in things
like our markdown/search help, settings/org, etc.), we have
a callback mechanism when you switch to the tab.  We were
being tricky and only calling it when the tab changed.

It turns out it's better to just always call the callback,
since these things are often in modals that open and close,
and if you open a modal for the second time, you want to do
the callback task for whichever setting you're going to.

There was actually kind of a nasty bug with this, where the
keyboard handling in the keyboard-help modal worked fine the
first time you opened it, but then it didn't work the second
time (if you focused some other element in the interim), and
it was due to not re-setting the focus to the inner modal
because we weren't calling the callback.

Of course, there are pitfalls in calling the same callbacks
twice, but our callbacks should generally be idempotent
for other reasons.
2018-06-04 09:02:58 -07:00
Robert Hönig 5d9a8cf64f bots: Add token to outgoing webhook zuliprc.
We want the Botserver to not only work with the
botserverrc, but also with a zuliprc of an outgoing
webhook. Because the Botserver uses the outgoing
webhook token for authentication, we need to include
it in the zuliprc for outgoing webhooks.
2018-06-04 08:39:24 -07:00
Robert Hönig d08c701bb4 frontend: Use bot_data instead of HTML data to generate zuliprc.
It is better to retrieve all information about a bot from
the central bot data store, rather than relying on the
bot card's HTML attributes.
2018-06-04 08:39:11 -07:00
Steve Howell 4b2e8b83c4 slash commands: Add /ping command (via zcommand).
This adds a /ping command that will be useful for users
to see what the round trip to the Zulip server is (including
only a tiny bit of actual server time to basically give a
200).

It also introduce the "/zcommand" endpoint and zcommand.js
module.
2018-06-02 09:40:12 -07:00
Anupam Dagar 0e8081093b hotkey: Add deprecation notice for '*' hotkey. 2018-06-02 08:59:42 -07:00
Joshua Pan 0f6211fbc3 node tests: Use run_test helper in templates.js. 2018-06-02 06:10:34 -04:00
Joshua Pan f4b341c2d4 node tests: Use run_test helper in user_pill.js. 2018-06-02 06:10:34 -04:00
Joshua Pan c9c06ae13c node tests: Use run_test helper in topic_data.js. 2018-06-02 06:10:34 -04:00
Joshua Pan 53d482194a node tests: Move templates.render to global definition. 2018-06-02 06:10:34 -04:00
Joshua Pan 9b1e0bbf3d node tests: Use run_test helper in input_pill.js. 2018-06-02 06:10:34 -04:00
Joshua Pan 43ba3196ee node tests: Use run_test helper in general.js. 2018-06-02 06:10:34 -04:00
Joshua Pan 7214315e00 node tests: Use run_test helper in buddy_data.js. 2018-06-02 06:10:34 -04:00
Joshua Pan f74d298478 node tests: Use run_test helper in bot_data.js. 2018-06-02 06:10:34 -04:00
Joshua Pan dd453e8dbe node tests: Remove unnecessary function in activity.js. 2018-06-02 06:10:34 -04:00
Steve Howell df9761391c node tests: Add narrow_local.js. 2018-06-01 12:45:02 -07:00
Steve Howell baa691db7d narrow: Fix how we select ids for narrows.
This commit fixes a couple regression related to narrowing.

For a long time we've had bugs where we too aggressively
preserve the currrent selection on topic -> stream
re-narrows ("s" key) even when the wider narrow may
have unread messages before the selection.

Also, we recently introduced a bug so that when you used
a link from the "copy link to conversation" (aka a "near"
query), it would advance you to your first unread message
despite the near:999 specifier.  (The code would work for
subsequent "near" queries once you had fetched some of
your original messages).

This commit introduces a new data structure called id_info (replacing
the select_strategy data structure) in various functions and uses that
to track all the ids of relevance.

Significantly rewritten by tabbott to handle a few extra corner cases,
and add a ton of comments explaining why it works the way it does.

Fixes #2091.
Fixes #9606.
2018-06-01 12:45:02 -07:00
Anupam Dagar 9674a139bf hotkeys: Change * to Ctr+s for starring a message.
Fixes: #9613.
2018-06-01 09:53:15 -07:00
Tim Abbott c8db7b7dd7 node: Provide a default window object for the node tests.
This is preparation for our migration of our JS pipeline to webpack,
which includes as part of the process a hack of exporting globals via
the window object.
2018-05-31 14:55:28 -07:00
Steve Howell 7642ed66cf Expand get_unread_ids() to all local narrows.
This commit makes it so that any query for
which we do a local filter leads to us
examining the full list of unread message
ids in our cache to find a potentially
unread message that passes the filter.  This
can often allow us to more immediately
jump to a new narrow with an appropriately
selected message.

Fixes #9319
2018-05-31 08:44:18 -07:00
Steve Howell 4c235bfe65 Handle non-local case in get_first_unread_info().
We want to be able to call get_first_unread_info() even
if we cannot apply a search locally.  It was returning
the correct value before, but this change removes a
blueslip warning that will allow our callers to remove
some guard code in a subsequent commit.
2018-05-31 08:44:18 -07:00
Steve Howell 7305d4f652 submessages: Add update_message() function.
We want to update message.submessages for new events, even
though our couple of widgets (poll/tictactoe) that can process
"update" events currently just apply events as "deltas"
to their current data.

This does fix a subtle issue where you may get incoming
events for a message that the client knows about but which
it hasn't yet activated as a widget.  Up until now,
we've rarely seen the bug that's fixed here, since it's
usually the case that as soon as we receive a message, we
widgetize it right away.
2018-05-30 14:47:36 -07:00
Shubham Padia 214ce1ccca streams: Add create and edit ui for is_announcement_only.
The user can now specify the value while creating a stream.
An admin can later change it via `Change stream permissions`
modal. Add is_announcement_only to subscription type text.
2018-05-30 14:22:15 -07:00
Shubham Padia 518764b843 streams: Change stream-privacy-model save button text to `Save changes`. 2018-05-30 14:18:41 -07:00
Tim Abbott bab09a6579 stream_types: Suggest private, shared history before protected history.
This feels like the more common use case for most users.
2018-05-30 14:17:32 -07:00
Steve Howell bfc13ecea4 submessages: Just send content for submessage events.
For some reason in my original version I was sending both
content and data to the client for submessage events,
where data === JSON.parse(content).  There's no reason
to not just let the client parse it, since the client
already does it for data that comes on the original
message, and since we might eventually have non-JSON
payloads.

The server still continues to validate that the payload
is JSON, and the client will blueslip if the server
regressses and sends bad JSON for some reason.
2018-05-30 13:53:11 -07:00
Steve Howell d76450a117 node tests: Test submessage.handle_event(). 2018-05-30 13:53:11 -07:00
Steve Howell a6e7520819 node tests: Use run_test helper in submessage.js. 2018-05-30 13:53:11 -07:00
Shubham Dhama 0caf55f2f0 settings_bots: Move bot_creation_policy_values to top-level.
Since ensure_i18n is dead we don't need to explictly load them.
2018-05-30 23:25:02 +05:30
Tim Abbott d9347dea3e i18n: Remove now-unused ensure_i18n function. 2018-05-30 09:13:48 -07:00
Robert Hönig 647c63050f botserver: Add outgoing webhook tokens to botserverrc.
The tokens will be used to authorize the server when sending
messages to the Botserver.
2018-05-30 10:00:19 -04:00
Shubham Padia 0ffcb7fccf search: Remove blueslip warnings for invalid emails in 'pm-with' filter.
Fixes #3380.
The blueslip warning mentioned in #3380 were from paths ending at
people.email_list_to_user_ids_string. Some additional blueslip warnings
were raised after using that function.
Although we can put a validation check somewhere in the call stack of
people.email_list_to_user_ids_string, this function itself is used to
validate the operand by the higher order functions, so it wouldn't make
sense to put a validation check before that. Instead, removing the
blueslip warning altogether was chosen.
people.email_list_to_user_ids_string was replaced by
people.reply_to_to_user_ids_string which is a blueslip-free version
of the same. Other blueslip warnings were removed.
2018-05-30 07:49:59 -04:00
Yashashvi Dave 3654d4f92d jquery-form: Remove jquery-form use from get-API-key form in user settings. 2018-05-30 03:14:39 +05:30
Robert Hönig 04d68d2570 code: Rename flaskbotrc to botserverrc. 2018-05-29 10:19:17 +02:00
Steve Howell 26e1fca7ed Add message_list.is_at_end() helper. 2018-05-28 16:49:57 -07:00
Shubham Padia 88b4a9f2d7 pm_list: Do not expand pm_list for invalid emails in `pm-with`. 2018-05-28 11:29:54 -07:00
Shubham Padia d9b0ab2ae7 narrow: Show non-existing user message for invalid emails.
Also adds people.is_valid_bulk_emails_for_compose and refactors
narrow_state.set_compose_defaults to use it.
2018-05-28 10:45:42 -07:00
Shubham Padia 2ce7ef73e8 compose: Add tests for compose_actions.on_narrow. 2018-05-28 10:45:42 -07:00
Shubham Padia 6ea6f5e0af search: Do not open compose box if invalid recipient present in `pm-with`.
If atleast one of the private_message_recipients is invalid, compose
box will not be opened.
Thanks to Aastha Gupta <aastha.gupta4104@gmail.com> for some preliminary
work on this.
2018-05-28 10:45:42 -07:00
Steve Howell a074056127 Add prev/next helpers for MessageList. 2018-05-27 22:41:19 -07:00
Joshua Pan 300654613e test: Cover majority of functions in MLD.
This gets coverage to about 97%.
2018-05-25 23:52:52 -07:00
Cynthia Lin 818611ac4e user groups: Sanitize pill_container selector to avoid escaped strings.
Fixes #9325.
2018-05-25 12:02:34 -07:00
Robert Hönig 53891a9bed bots: Don't name section headers in flaskbotrc.
The Botserver uses section headers in the flaskbotrc to
determine which bot to run. Silently setting the section
headers to a bot's username is confusing and makes it
harder for Botserver users to figure out how to get the
Botserver to run the bots they want. This commit empties
all flaskbotrc section headers and thus makes the assignment
of bots explicit and mandatory.
2018-05-25 10:33:40 -07:00
Shubham Padia 5d750a5d44 search: Respect spaces in person name in new suggestions only.
Fixes #6515.
New suggestions for `sender:King ha` will respect spaces and the new
suggestion will be `Sent by King Hamlet <email>` instead of `Sent by King,
search for ha`. But if first term of sender operand is a valid user email,
tokens will be seperated by spaces. e.g `sender:hamlet@zulip.com abc`
will show `Sent by King Hamlet <email>, search for abc`.
2018-05-25 09:03:27 -07:00
Steve Howell 435719c65b Add a schema checking concept to the web app.
This starts the concept of a schema checker, similar to
zerver/lib/validator.py on the server.  We can use this
to validate incoming data.  Our server should filter most
of our incoming data, but it's useful to have client-side
checking to defend against things like upgrade
regressions (i.e. what if we change the name of the field
on the server side without updating all client uses).
2018-05-24 09:30:22 -07:00
Steve Howell a5dee62b8f transmit.js: Add reply_message(). 2018-05-24 09:30:22 -07:00
Steve Howell 84c9be45af node tests: Remove requirement to test all templates.
We have less urgency to test all templates now.  The
most common error is probably unbalanced tags, and our
python-based template checker catches those problems
pretty well.

It's still possible to create bad templates, of course,
but the node tests have never been super deep at finding
semantic errors.
2018-05-24 09:30:22 -07:00
Tim Abbott 5a5ca12f6f hotkey: Move ctrl+[ back from cmd+[.
This was incorrectly changed; the goal here is to match what vim does
for this keyboard shortcut.

Fixes #9525.
2018-05-24 08:31:55 -07:00
Shubham Dhama d1da4116ef node tests: Add `removeClass` to `stub_out_jquery`. 2018-05-23 15:29:34 -07:00
Joshua Pan dcee398622 onboarding: Redesign intro_reply hotspot in bottom whitespace.
This is a trial to have the first reply hotspot in the bottom
whitespace (and stick there until "Got it!"  is pressed).

Tweaked by tabbott to clean it up a bit.  Still needs more work on the
visuals.
2018-05-23 14:22:19 -07:00
Yashashvi Dave 958040b1fc user_pills: Extract generic functions for typeahead and pill creation.
This refactoring make it easier to use our user pill typeahead logic
in other parts of the app.

Two commits by Yashasvhi squashed together by Tim.
2018-05-23 12:07:16 -07:00