Commit Graph

3208 Commits

Author SHA1 Message Date
Ryan Rehman 60eef68f59 refactor: Extract `set_up_typeahead_on_pills` to a new file.
We move this function from `user_pill.js` to `pill_typeahead.js`.
The function has also been renamed to `set_up`.

The move was made because there are plans to update the pills
typeahead (i.e. to include user-groups/streams in the results).
Thus this function should not belong in `user_pill.js`.
2020-08-04 15:58:12 -07:00
Anders Kaseorg a0a0189df1 puppeteer_tests: Fix Prettier formatting of 05-stars.js.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-08-04 15:51:54 -07:00
Ryan Rehman b4888c1251 subscriptions: Refactor template rendering of `stream_privacy_policy`.
This makes it similar to `stream_post_policy`.
2020-08-04 15:48:35 -07:00
Ryan Rehman 73fac8e1d7 toggler: Allow skipping over disabled tabs.
This commit allows skipping over any disabled tabs
that are in the middle when using the left or right
arrow keys.

We also add `enable_tab` to the `components` API.
2020-08-04 15:48:34 -07:00
Aman Agrawal 1b05f8e6c9 stream_topic_history: Update max msg id of stream post msg deletion.
After the latest message in a stream is deleted, we should update
the max_message_id in the stream.

Removed false comment in message_util.get_messages_in_topic
this method only takes 2ms for 10,000 messages loaded locally.
2020-08-04 15:29:03 -07:00
Aman Agrawal b32dc5e58f stream_topic_history: Update topic last msg_id after msg deletion.
Fixes #15992.
If the last message of the topic was deleted, we update the stored
message_id in the topic history so that the topic order in topic_list
is updated correctly.
2020-08-04 15:29:03 -07:00
Dinesh b05bb93425 puppeteer: Add edit test. 2020-08-04 14:41:00 -07:00
Dinesh 31b46fd0ee puppeteer: Add stars test. 2020-08-04 14:40:59 -07:00
Dinesh 50a01311c0 puppeteer: Fix messages not being echoed locally.
When messages weren't locally echoed,
`wait_for_full_processes_message` fails to assert that the message
is being sent. It was figured out by tabbott that the messages
aren't locally echoed because of content no loading completely.

So, this commit changes the `log_in` function to wait till
the selector '#zhome .message_row' is visible which indicates
that the cotent is loaded.

Removed the waitForNavigation in the `log_in` as it would
become a redundant check after this change.

Also removed this same check present in 03-compose.js which
becomes reduntant as we already do it in `log_in`.
2020-08-04 14:33:37 -07:00
Dinesh 90d956d2ed puppeteer: Rename settings test to be the last test.
This test changes user password causing all subsequent
tests to fail. Since rechanging the password would be
a redudant test/task or having manually entering the
new password in every test after this aren't good ideas,
this commit makes the settings test run in the end by
renaming it be numbered 16. It is assumed that we'll
end up having 16 tests seeing the number of tests in
casper and considering 03 and 02 from casper are being
combined as 02-message-basics.js. Though 03 of casper
has not yet been added in message-basics test it will
soon be added.
2020-08-04 14:33:37 -07:00
Anders Kaseorg 6ec808b8df js: Add "use strict" directive to CommonJS files.
ES and TypeScript modules are strict by default and don’t need this
directive.  ESLint will remind us to add it to new CommonJS files and
remove it from ES and TypeScript modules.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-31 22:09:46 -07:00
Anders Kaseorg 39c3a02736 casper_tests: Replace const with var.
Apparently "use strict" also makes PhantomJS more strict about syntax
it doesn’t support.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-31 22:09:46 -07:00
Anders Kaseorg 48102c15a3 node_tests: Add missing mock children.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-31 22:09:46 -07:00
Anders Kaseorg 7dd070df44 zjsunit: Return true from set handler for window Proxy.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-31 22:09:46 -07:00
Anders Kaseorg 59ba7e38c0 settings_profile_fields: Fix sortablejs import.
Commit 114cc1ec25 (#15949) introduced a
subtle bug because sortablejs provides both a CJS module and an ES
module that expose different interfaces to CJS require() under
Webpack.  This difference will disappear when we convert
settings_profile_fields to an ES module.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-31 20:16:26 -07:00
Anders Kaseorg 6e84e49079 casper_tests: Follow rename of #home to #message_feed_container.
Commit b34d46e00b (part of #15650)
renamed this id without adjusting this Casper test.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-31 20:01:05 -07:00
Vishnu KS e736bc3ec6 sponsorship: Ensure that all the fields are filled in form. 2020-07-31 10:36:53 -07:00
Dinesh a554eda8f9 puppeteer: Add settings test.
All checks from the corresponding casper test have been added.
2020-07-30 16:44:24 -07:00
Dinesh 1feb2f4d08 puppeteer: Extend fill_form function to support dropdown menus. 2020-07-30 16:44:24 -07:00
YashRE42 b4891a5841 navbar: Rename tab_bar to message_view_header.
Prior to commit eb4a2b9d4e the center
area of the navbar was based on a structure that appended crumbs or
"tabs" as <li>s, forming a tab_bar and a tab_list.

However, in eb4a2b9d4e we apply a new
style and structure to the navbar which lets go of the convention of
tabs. Hence, we'd like to purge the tab_bar and tab_list labels from
our code base.

We purged tab_list in 1267caf5009118875f47fdafe312880af08024e1.

This commit purges tab_bar, it includes:
- A blanket search and replace of tab_bar with message_view_header.
- Splitting a single line comment in
  tab_bar.js / message_view_header.js.
- The renaming of tab_bar.js to message_view_header.js.
- The renaming of tab_bar.hbs to message_view_header.hbs.
- A blanket search and replace of tab_data with
  message_view_header_data.
- Replacing the single occurrence of tabbar with message_view_header
  (it was within a comment.)
2020-07-30 16:23:13 -07:00
Priyank Patel dda7e938f4 puppeteer: Fix flake with compose box input.
There were a lots of flakes in CI recently because typeahead didn't
appear when Enter was pressed and real emails are not accepted as
valid inputs. To fix this we wait for typeahead to appear and then
click that instead of Enter. We also use delay option to type the
email (100ms delay between keypresses) since without we'd also get
flakes.

Re-enable puppeteer test in CI after this fix too.
2020-07-30 11:32:32 -07:00
Anders Kaseorg 226598edc4 js: Use Handlebars as a module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-29 11:17:24 -07:00
Steve Howell 3be0777341 node fixtures: Sort all the fixture events. 2020-07-29 08:37:18 -04:00
Steve Howell 9a12b57154 node fixtures: Organize realm update events lexically.
I also use double-underscore more consistently.
2020-07-29 08:37:18 -04:00
Priyansh Garg c752f955de registration: Improve registration form.
Improved markup of help-text.
Showing Email as plain-text instead of disabled input.
Changed page heading to 'Create your organization' in realm creation form
and 'Create your account' in normal signup form.
Grouped org settings and user settings with fieldsets.
Reduced space between Password field and Password strength bar.

Also, updated the corresponding test cases.

Partially Fixes: #15750.
2020-07-28 17:07:25 -07:00
sahil839 dcc24992b9 streams: Store list of stream ids instead of names for sorting.
We will store list of stream ids to sort streams instead of names.
We have added a compare_function for sorting the list of stream_ids
by comparing stream names.

This change helps us to remove a couple of get_sub calls and using
stream ids instead of name also helps in avoiding bugs caused due
to live update on renaming of stream.
2020-07-28 17:01:17 -07:00
sahil839 ed96758614 stream_data: Add subscribed_stream_ids function.
We add a function subscribed_stream_ids which returns an array
of stream ids of all subscribed streams.

This is a prep commit for changing the logic for sorting streams
to store stream ids instead of names.
2020-07-28 16:57:50 -07:00
Aman Agrawal 08701d0287 recent_topics: Add support for vim keys.
User can now user `j`, `k`, `l`, `h` keys to navigate along
with arrow keys, which is inline with our message navigation
hotkeys.
2020-07-28 16:33:32 -07:00
Aman Agrawal b34d46e00b css: Rename #home id to #message_feed_container. 2020-07-28 16:33:32 -07:00
Aman Agrawal 0859a91b14 hashchange: Go through hashchange to narrow to All messsages.
We should not allow every function who wants to narrow to All
messages to come up with their own method to do so. This
commit makes existing such functions use hashchange library to
do so.

Remove click event on All message button, it already contains
an <a> tag which navigates correctly.
2020-07-28 16:33:32 -07:00
Aman Agrawal 8b29c38e62 info_overlay: Make them overlays from quasi-overlays.
We always use hashchange.go_to_location method now to open the
info_overlay, this makes sure that the url hash are reliable and
hotkeys don't get confused if an overlay is open or not.

We don't want to change hash to "" (this also doesn't navigates
us to 'All messages' view, hence the bug was not noticed.) on
exit of info_overlay.
2020-07-28 16:33:25 -07:00
Anders Kaseorg 0e0baca41e typescript: Enable strictNullChecks.
Let’s do this right from the beginning instead of making a mess to
clean up later.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-28 11:01:35 -07:00
Anders Kaseorg a43307bc4e js: Use Moment.js as a module.
Note that require("moment") and require("moment-timezone") resolve to
the same thing, but the latter adds timezone support as a side effect.
So I went with the latter in every file where .tz is used.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-28 10:54:35 -07:00
Anders Kaseorg 114cc1ec25 settings_profile_fields: Use SortableJS as a module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-28 10:54:35 -07:00
Anders Kaseorg 1d59fc272c js: Use Marked.js as a module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-28 10:54:35 -07:00
Anders Kaseorg bcab7efb37 js: Use XDate as a module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-28 10:54:35 -07:00
Anders Kaseorg c66931d4cd js: Use clipboard.js as a module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-28 10:54:35 -07:00
Anders Kaseorg f0021df3d4 people: Use blueimp-md5 as a module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-28 10:54:35 -07:00
Steve Howell fb06aa9419 node tests: Swap actual/expected in various assert calls. 2020-07-28 11:48:55 -04:00
Tim Abbott 49926bc07b node tests: Fix schema for stream events. 2020-07-27 16:52:29 -07:00
Ryan Rehman 15c5dadb73 message view: Move live update logic of stream name to `message_store`. 2020-07-27 11:00:31 -07:00
Ryan Rehman 131a1dd54f message view: Move live update logic of avatar url to `message_store`. 2020-07-27 11:00:31 -07:00
Ryan Rehman 06d0dc1ffa message view: Move live update logic of full name to `message_store`.
This is done to decouple our message view related update events
from MessageListData as there are plans to create multiple
MessageListData objects. Instead we update the `stored_messages`
which tracks the complete data for all messages.
2020-07-27 11:00:31 -07:00
Ryan Rehman e85bc853d6 message list: Refactor and update API to include `rerender_view`.
This is a necessary prep commit as our message live update
functions will call this function, outside the MessageList class.
2020-07-27 11:00:31 -07:00
Steve Howell 64894fe8e4 node tests: Avoid "orig_foo = bar" idiom.
We use either override or with_field, as
appropriate.
2020-07-27 11:07:41 -04:00
Steve Howell 329f38975e zjsunit: Add with_field helper.
This just lets us temporarily assign a value
to a field.

Differences with the "override" scheme:

    * override only works on globals
    * override (when passed in via run_test) will
      just automatically clean up at the end of
      the function
2020-07-27 11:07:41 -04:00
Dinesh 2e864d487e puppeteer: Add subscriptions test and required functions.
Tests stream subscriptions and stream creation.
2020-07-26 17:10:56 -07:00
Dinesh 2835092010 puppeteer: Make fill_form function empty text fields before filling. 2020-07-26 17:10:56 -07:00
Dinesh 56c5e0318f puppeteer: Remove set_pm_recipient.
Previous commit introduced same function in pm_recipient object.
So, this comit removes the duplicate `set_pm_recipient`.
2020-07-26 17:10:56 -07:00
Dinesh 4998e32b10 puppeteer: Add compose tests and required functions in common.js.
Thanks to Priyank Patel for helping debug flakes.
2020-07-26 17:10:56 -07:00