Commit Graph

132 Commits

Author SHA1 Message Date
Priyank Patel 3f32ffc4eb compose: Use new ID-based api for sending messages.
This only happens if the realm is not a zephyr realm.

Finishes part of #9474.
2019-05-27 22:58:42 -07:00
Steve Howell 6b39d6004e zjquery: Use Proxy to detect undefined stubs.
We now use a Proxy to wrap zjquery elements, so
that we can detect callers trying to invoke methods
(or access attributes) that do not exist.  We try
to give useful error messages in those cases.

The main impact here is that we force lots of tests
to explicitly stub `length`.

Also, we can't do equality checks on zjquery
objects any more due to the proxy object, but the
easy workaround is to compare selectors.  (This
is generally an unnecessary technique, anyway.)

The proxy wrapper is fairly straightforward, and
we just have a few special cases for things like
"inspect" that happen when you try to print out
objects.
2019-05-20 11:28:32 -07:00
Yashashvi Dave cb85ca8601 models: Alter video_chat_provider field type to integer.
Migration rewritten by tabbott because it did not work.
2019-05-13 12:02:28 -07:00
vinitS101 81b5a72252 admin_settings: Change maxfilesize to max_file_upload_size.
Renamed maxfilesize to max_file_upload_size for consistency.
Related to #12152.
2019-05-03 17:36:09 -07:00
Siddharth Varshney 0d25baedfa compose: Fix narrow button text when switching to PM.
This changes the "new private message" button to be instead "new
conversation" when looking at PMs, to avoid confusion that the button
was the right thing to do to reply to the current private message
conversation.

Fixes #11679.
2019-03-11 21:58:05 -07:00
Abhinav Singh e7c8077abc edit: Add support for using video call link in message edit.
This code will correctly add video call link to the message
textarea based on whether 'Add video call' was selected from
message composition form or message edit form.

The implementation was semi-rewritten by tabbott to remove an
unnecessary global variable, with fixes for the unit tests from
showell.

Fixes #11188.
2019-02-02 11:03:31 -08:00
Steve Howell 6116ede5f7 compose tests: Avoid global `event` var.
It's better to be explicit here and avoid leaking
between tests.
2019-02-02 07:05:16 -08:00
Steve Howell 8e88ca3a46 compose tests: Encapsulate helper.
We don't need to have global vars shared across all
functions using `setup_parents_and_mock_remove`.
2019-02-02 07:05:16 -08:00
Steve Howell 37c78abe14 frontend: Use topic on message.
This seems like a small change (apart from all the
test changes), but it fundamentally changes how
the app finds "topic" on message objects.  Now
all code that used to set "subject" now sets "topic"
on message-like objects.  We convert incoming messages
to have topic, and we write to "topic" all the way up
to hitting the server (which now accepts "topic" on
incoming endpoints).

We fall back to subject as needed, but the code will
emit a warning that should be heeded--the "subject"
field is prone to becoming stale for things like
topic changes.
2019-01-07 19:20:56 -08:00
Marco Burstein 9ddadd39f4 compose: Add support for using Zoom as the video chat provider.
This adds Zoom call properties to the `Realm` model, creates endpoints
for creating calls, adds a frontend and tests.

Fixes #10979.
2019-01-07 10:00:02 -08:00
Steve Howell 35b904b184 subject -> topic: Fix subject in opts.
It's kinda difficult to track down all the interactions
with the opts that go through compose_actions.start(),
but I think I got everything.
2018-12-16 11:26:18 -08:00
Steve Howell d7c2577ffb subject -> topic: Rename compose fields.
The stream/topic edit areas now have these ids:

        #stream_message_recipient_stream
        #stream_message_recipient_topic

They are pretty verbose, but being able to grep
for these without noise does have some value.
2018-12-09 21:28:45 -08:00
Rohitt Vashishtha d7a0bd4a6c subject-to-topic: Add topics to compose_state.js. 2018-11-14 23:24:06 -08:00
Marco Burstein 1490653e42 tests: Test the compose buttons in stream and private narrows.
Also add a test for the `narrow.is_in_private_narrow` function used by
the mobile compose popover.
2018-10-31 16:59:53 -07:00
Shayan Toqraee a4b14b8526 compose.js: Move set rtl logic to keyup event.
This fixes an issue where the ltr/rtl translation lagged one character
behind as a user typed.
2018-08-14 11:41:53 -07:00
Shubham Padia e21e8c1bae compose: Hide subscribe button and change text for waiting period users.
Fixes #10124.
Users in the waiting period category cannot subscribe other users to
a stream. When a user tries to mention another unsubscribed user, a
warning message appears with a subscribe button on it to subscribe
the other user.
This commit removes the subscribe button and changes the warning text
for users in the waiting period category.
2018-08-13 10:18:35 -07:00
Shubham Padia 3f019cafb2 compose: Improve error handling when subscribing other users to a stream.
Instead of displaying a fixed error message inside the yellow bar itself,
now the yellow bar disappears on error and a red compose_error is shown.
The error message is the one returned from the server.
2018-08-13 10:18:35 -07:00
Steve Howell 2d8f7843a2 node tests: Consolidate some set_global() calls.
Hopefully these cleanups will make it a little easier
to migrate our tests to take advantage of a true
module loading system.
2018-08-02 08:02:12 -04:00
Joshua Pan 28d04f6960 tests: Test composing scheduling reminder indicator. 2018-07-31 11:23:20 -04:00
Joshua Pan bf8aa2a1d7 tests: Remove unnecessary jQuery stub.
$().is(':visible') is already implemented in zjquery.
2018-07-31 11:23:20 -04:00
Joshua Pan 8de454ad2d tests: Test private msg validation with zephyr mirror. 2018-07-24 07:51:11 -04:00
Joshua Pan f5ee360c57 tests: Test nonexistent_stream_reply_error(). 2018-07-24 07:51:11 -04:00
Joshua Pan ac133c357c tests: Test Google Hangouts video call link. 2018-07-24 07:51:11 -04:00
Yashashvi Dave bbe326dd29 message edit: Add markdown shortcuts to message edit UI.
This makes the ctrl+B, ctrl+I, ctrl+shift+L shortcuts available when
doing message editing.

Fixes #9917.
2018-07-23 10:41:46 -07:00
Steve Howell 353843aa7c node tests: Add rtl/ltr tests for compose box. 2018-07-11 19:20:22 +05:30
Shubham Padia 7a3f2bbfb5 pills: Enable user avatar images for user pills.
Fixes #9842.
Enables avatar images in pills wherever user_pill.js is used.
(e.g composebox, user group settings)
Changes to search_pill.js are not made as search pills haven't been
added yet completely and search_pill.js just contains the preparatory
code right now.
No change to compose_pm_pill.js is not required as it uses
`user_pill.create_item_from_text` in its `create` function.
2018-07-10 15:07:56 +05:30
Shayan Toqraee 0757d022f5 messages: Add support for right-to-left messages.
This implements right-to-left message automatic detection support in
the compose box as well as the message feed.  Full unit tests and
support in the message-editing UI are for future work (as are
potentially more fancy things like supporting things like
right-to-left multi-word names for users/streams/etc.).

Fixes #3123.
2018-07-10 10:47:56 +05:30
Shubham Dhama 8852ed588a style: Remove redundant brackets from typeof operator. 2018-06-05 09:22:26 -07:00
Shubham Dhama cc03f9fb8f eslint: Enable space-infix-ops rule.
More about rule at  https://eslint.org/docs/rules/space-infix-ops
2018-06-05 00:47:35 +05:30
Shubham Dhama c6738889a9 eslint: Add and enable `space-unary-ops` rule.
Info about rule at https://eslint.org/docs/rules/space-unary-ops.
2018-06-05 00:47:35 +05:30
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
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
Aditya Bansal 81a677e02b reminders: Refactor relevant code to live in a separate reminder.js. 2018-05-21 09:03:31 -07:00
Shubham Padia ffa41311ca tests: Add node test for compose.needs_subscribe_warning. 2018-05-18 15:24:40 -07:00
Shubham Padia 10a65a62db compose: Display error for non-admin trying to post to announce_only stream.
Partially fixes #4708.
Implements a first version (v1) for the feature. The next step would be
to allow admins to toggle `is_announcement_only` in the UI.
2018-05-16 13:35:45 -07:00
Steve Howell 42435db492 Add run_test helper for individual tests.
This run_test helper sets up a convention that allows
us to give really short tracebacks for errors, and
eventually we can have more control over running
individual tests.  (The latter goal has some
complications, since we often intentionally leak
setup in tests.)
2018-05-15 08:24:44 -07:00
Tim Abbott 6e149a7594 lint: Add JS indentation eslint rules for node_tests.
The only difference between this as the main project's lint rules is
that we dont have the OuterIIFE setting.
2018-05-06 19:35:18 -07:00
Steve Howell d4fc92c1c7 refactor: Rename method to compose_fade.update_all().
The function was misnamed before.
2018-04-28 11:15:14 -07:00
Steve Howell e5885fa8e4 Add compose.needs_subscribe_warning.
This function replaces part of compose_fade.would_receive_message(),
which has a real janky interface of returning true, false, or
undefined.

We don't need to couple the semantics of compose fading to whether
we help subscribe a mentioned user.  They're mostly similar, but they
will probably diverge for things like bots, and the coupling makes
it difficult to do email -> user_id conversions.

One thing that changes here is that we get the stream name from
compose_state, instead of compose_fade.focused_recipient.  The
compose_fade code uses focused_recipient for kind of complicated
reasons that don't concern us here.
2018-04-26 08:42:47 -07:00
Rohitt Vashishtha a836473746 zblueslip: Convert node_tests/compose.js to zblueslip. 2018-04-19 15:02:00 -04:00
Steve Howell f56b4b7ec2 zjquery: Simplify validation for $(...).
We flatten the code a bit by removing a check that type is object,
and we replace it later with a check that type is string.

We also no longer allow document-like objects to be wrapped based
on the location-attribute-is-present hack.  Instead, we want the
tests to just set document to 'document-stub'.
2018-04-12 11:37:01 -07:00
Balaji2198 c63d1c9205 node tests: Cover compose_not_subscribed in compose.js.
This commit covers the node tests to close(X) button and
subscribe button click handlers in compose.js.
2018-04-07 20:23:21 -07:00
Balaji2198 605916f6d7 compose: Add subscribe button to the not subscribed stream error message.
Before that, we needed to go the stream settings to subscribe to a
particular stream.

Fixes #3877.
2018-04-05 17:15:18 -07:00
Tim Abbott 938c4cee08 settings: Add option to control Jitsi video chat integration.
Fixes #8922.
2018-04-02 16:55:16 -07:00
Steve Howell cd8c15f1cf pills: Use a template to render the pills. 2018-03-31 09:32:52 -07:00
Shubham Padia 077475c563 compose: Don't warn if mentioned stream members form a superset.
Fixes #8634.
Suppress private stream warning if you're to a stream whose
membership is a subset of #mentioned-stream-name.
2018-03-09 10:46:41 -08:00
Steve Howell 3a1bf04a56 compose: Add pills for typing in PM recipients.
@brockwhittaker wrote the original prototype for having
pills in the recipient box when users compose PMs (either
1:1 or huddle).  The prototype was test deloyed on our
main realm for several weeks.

This commit includes all the original CSS and HTML from
the prototype.

After some things changed with the codebase after the initial
test deployment, I made the following changes:

    * In prior commits I refactored out a module called
      `user_pill.js` that implemented some common functions
      against a more streamlined version of `input_pill.js`,
      and this commit largely integrates with that.

    * I made changes in a prior commit to handle Zephyr
      semantics (emails don't get validated) and tested
      this commit with zephyr.

    * I fixed a reload bug by extracting code out to
      `compose_pm_pill.js` and re-ordering some
      calls to `initialize`.

There are still two flaws related to un-pill-ified text in the
input:

    * We could be more aggressive about trying to pill-ify
      emails when you blur or tab away.

    * We only look at the pills when you send the message,
      instead of complaining about the un-pill-ified text.
      (Some folks may consider that a feature, but it's
      probably surprising to others.)
2018-03-07 15:53:11 -08:00
Tommy Ip 5ee6c608c0 message edit: Allow uploading files.
Fixes: #198.
2018-03-05 10:42:38 -08:00
Akash Nimare 9dba134c7a markdown: Do not use CMD+CTRL on macOS.
This fixes an issue where we allowed both the CMD+CTRL keys for our
compose markdown shortcuts.  The correct behavior is to allow either
Cmd or Ctrl, based on whether it's MacOS (Cmd) or Ctrl
(Linux/Windows), to match how those platforms work.

Fixes #8430.
2018-02-20 09:50:10 -08:00
Steve Howell 1f6ddf0110 refactor: Extract transmit.js from compose.js.
We now isolate the code to transmit messages into transmit.js.
It is stable code that most folks doing UI work in compose.js don't
care about the details of, so it's just clutter there.  Also, we may
soon have other widgets than the compose box that send messages.

This change mostly preserves test coverage, although in some cases
we stub at a higher level for the compose path (this is a good thing).
Extracting out transmit.js allows us to lock down 100% coverage on that
file.
2018-02-20 09:29:26 -08:00