Commit Graph

36280 Commits

Author SHA1 Message Date
majordwarf 7c8f8a89f2 css: Use SCSS nesting in zulip.scss for `input`. 2020-05-20 11:17:04 -07:00
majordwarf 582f638af3 css: Use SCSS nesting in zulip.scss for `.app-main`. 2020-05-20 11:02:03 -07:00
majordwarf 50a9eccd77 css: Reorder zulip.scss to put `.app-main` alongside. 2020-05-20 11:02:03 -07:00
majordwarf 3d5352f875 css: Use SCSS nesting in zulip.scss for `#panels`. 2020-05-20 11:02:03 -07:00
majordwarf 4eaf99b9fa css: Use SCSS nesting in zulip.scss for `.fade-in-message`. 2020-05-20 11:02:03 -07:00
majordwarf 685335eb44 css: Use SCSS nesting in zulip.scss for `#feedback_container`. 2020-05-20 11:02:03 -07:00
majordwarf 49cc9b680c css: Reorder zulip.scss to put `#feeback_container` alongside. 2020-05-20 11:02:03 -07:00
majordwarf faf6a274a0 css: Use SCSS nesting in zulip.scss for `.top-messages-logo`. 2020-05-20 11:02:03 -07:00
majordwarf 82c8c0e9ff css: Remove ignored css rulesets in zulip.scss.
`vertical-align` property is ignored due to the display.
With 'display: block', vertical-align should not be used.
2020-05-20 11:02:03 -07:00
Rohitt Vashishtha c24aaa0e74 portico-css: Style codeblocks to look neater.
The currrent css of codeblocks left too much empty space between
the lines as well as indented the first character of a codeblock
slightly towards the right.

This commit fixes both of these, thus making codeblocks look closer
to what someone would expect codeblocks to look like in their text
editor.
2020-05-20 10:18:29 -07:00
Rohitt Vashishtha 1e4ad0bdfc js-api: Migrate and test send-message example. 2020-05-20 10:18:29 -07:00
Rohitt Vashishtha 203b722624 js-api: Migrate and test create-user example. 2020-05-20 10:18:29 -07:00
Rohitt Vashishtha 61f6a6e9bb linter: Allow using javascript instead of JavaScript for calling examples.
This allows us to call js code examples as follows:

`{generate_code_example(javascript)|/users:post|example()}`
2020-05-20 10:18:29 -07:00
Kartik Srivastava 5f3849b517 openapi/markdown_extension: Avoid shelling out to node for JS snippets.
This refactors render_javascript_code_example to avoid shelling out to
node and parse the javascript file with python instead, to get example
code snippets.
2020-05-20 10:18:29 -07:00
Rohitt Vashishtha 6dd4030e67 js-api: Add hooks to run tests and render docs of JS API examples.
This commit adds python code to call javascript_examples.js in its
two supported modes. tools/test-api asserts that the example output
is as expected, whereas the API markdown extension is used to render
these examples in the docs.
2020-05-20 10:18:29 -07:00
Kartik Srivastava 642d1a20d0 openapi/markdown_extension: Refactor extract_code_example.
This refactors `extract_code_example` to return a nested list
of code snippets between '{code_example|start/end}' instead of
returing a list of all the lines between '{code_example|start/end}'
markers in the code examples.

Appropriate changes have been made to render_python_code_example.
2020-05-20 10:18:29 -07:00
Kartik Srivastava 302906211d js-api: Refactor ExamplesHandler to avoid running examples in a loop.
This refactors `ExamplesHandler` to avoid running examples in a loop
and add result objects to `response_data` array one by one with
`generate_validation_data`.
2020-05-20 10:18:29 -07:00
Rohitt Vashishtha 31d04fb370 js-api: Add module to create and run JS API examples.
This file will act as the container for all JS API examples to use
in our documentation, similar to our python and curl API testing
and examples generation code.

This module has two modes of operation:

- node javascript_examples.js generate-responses

   This mode runs all the examples against a server and prints the JSON
   output of all the examples we ran.

- node javascript_examples.js generate-example <endpoint>

   This mode prints example code for endpoints like: /users:post. We then
   want to render this full example code in our docs.
2020-05-20 10:18:29 -07:00
Rohitt Vashishtha 1091615b17 edit-bot: Show dropdown list widget for selecting owner.
This commit removes user_dropdown in favor of the common
dropdown_list_widget for our bot edit forms.
2020-05-20 09:51:38 -07:00
Rohitt Vashishtha 4d14ba41ba dropdown-list-widget: Properly handle disabled state.
We wrap the [reset] anchor tag in a button so that we can set 'disabled'
attribute on it. We change the styles to hide the [reset] button and the
pencil icon when the widget is disabled.

We also need to call `e.preventDefault()` in the event handler since now
the anchor tag behaves as a button.
2020-05-20 09:51:38 -07:00
Aman Agrawal f4e70714b4 ci: Pin codecov version to avoid nondeterministic behaviour.
* This fixes the gov find error when dicovering files.
From v2.0.16, codecov-python uses "find" to discover files which
is buggy on some platforms.
Filed issue as https://github.com/codecov/codecov-python/issues/250
2020-05-20 09:47:51 -07:00
Aman Agrawal 370d1b6ca7 recent-topics: Handle topic and topic's stream edit updates.
* Implementation and logic similar to recent_sender.process_topic_edit.
2020-05-20 09:44:50 -07:00
Aman Agrawal 04cdc89681 recent_topics: Handle mute/unmute update to topic.
* We don't remove topic data when it's muted. We will filter it
before rendering.
2020-05-20 09:44:50 -07:00
Aman Agrawal 76b0c6de86 recent-topics: Add module.
Add methods to extract recent topics from received messages.
Process new messages as they are received.
Use new messages received from the server to extract recent_topics.
Node tests added.
2020-05-20 09:44:50 -07:00
Aman Agrawal 0504c61bfd semgrep: Use pattern-where-python operator to filter patterns.
See https://github.com/returntocorp/semgrep/blob/experimental/docs/config/advanced.md#pattern-where-python for usage.

This helps us minimize duplication of similar patterns.
2020-05-20 09:37:26 -07:00
Vishnu KS 9442835386 droplets: Make sure the username is lowercase.
Otherwise, if someone tries to create a droplet with a mixed case username,
the existing DNS records (which are always lowercase) would not be deleted.

Also, existing droplets would not be destroyed(--recreate) if there is a mismatch
in case. Unlike DNS records, droplets are created with case sensitive
hostnames.

Plus it's neater to have lowercase hostnames.
2020-05-20 09:32:11 -07:00
Mateusz Mandera 2f5fd272aa auth: Gracefully handle bad http responses from IdP in social auth.
If the IdP authentication API is flaky for some reason, it can return
bad http responses, which will raise HTTPError inside
python-social-auth. We don't want to generate a traceback
in those cases, but simply log the exception and fail gracefully.
2020-05-20 09:30:56 -07:00
orientor 915d801327 openapi: Add 'tags' attribute to endpoints.
'tags' attribute is helpful in differentiating and grouping the
endpoints on basis of their usage. For example tags like 'messages'
help in grouping all endpoints related to messages and thus make the
api specification more user-friendly. So give tags to the endpoints
on the basis of what heading they are under in the API docs.
2020-05-19 23:17:31 -07:00
orientor 3467d2fe68 openapi: Add 'operationId' attribute to endpoints.
'operationId' helps code generators in naming functions and other purposes.
So name operationId of endpoints as their function names in python-zulip-api
if it exists else use most appropriate function name.

Part of #14100 .
2020-05-19 23:13:39 -07:00
Kartik Srivastava 83f975e57e api docs: Document POST /users/{user_id}/reactivate endpoint. 2020-05-19 23:10:50 -07:00
Kartik Srivastava 59ac3ca95f openapi/python_examples: Add reactivate_user example. 2020-05-19 23:10:50 -07:00
Kartik Srivastava 4af7ad70e7 openapi: Add OpenAPI data for /users/{user_id}/reactivate. 2020-05-19 23:10:50 -07:00
Tim Abbott c3d3324295 puppet: Add link to the sources for Zephyr patches. 2020-05-19 20:54:11 -07:00
Tim Abbott a35e71ebbc puppet: Update package name for boto-on-python3.
The python3-boto3 package is the maintained fork that supports Python
3; it was renamed in Ubuntu Bionic from the original Ubuntu Xenial name.
2020-05-19 20:25:11 -07:00
Tim Abbott 1c28770810 puppet: Fix apt_repo_debathena setup_file path.
There was a typo introduced here when scripts_path was added.
2020-05-19 20:21:30 -07:00
Priyank Patel b2f566f53e puppeteer: Add screenshot method to common module.
This will be useful for debugging purposes and we'll use it to take
a screenshot on failure.
2020-05-19 15:58:04 -07:00
Priyank Patel 1f367ed537 puppeteer: Rename run functions to something more descriptive. 2020-05-19 15:58:04 -07:00
Priyank Patel d0a7540534 puppeteer: Add run_test method to common.
This method does all error handling and removes ~5-6 lines of try/catch
block across each test file.
2020-05-19 15:58:04 -07:00
Priyank Patel 41447a0d5c puppeteer: Add a common module for resuable code.
In common.js, we now have a single browser instance for the whole
test. When we update the test-js-with-puppetter to spawn a single
node process, like we do for node tests, we will save time on having
to open an new browser for every test + puppetter start up cost.

We will also add some more helpers here like a method for
filling out a form easily etc.
2020-05-19 15:58:04 -07:00
Dinesh ab64d7936f puppeteer_tests: Remove explicit redirect from confirmation page.
Before fixing `test-js-with-puppeteer` to to use the right webpack
setup, redirects weren't happening properly. The line this commit
removes did a redirect to the register page. This line is removed
as the redirect will happen automatically as expected with fixing
`test-js-with-puppeteer`.
2020-05-19 15:54:00 -07:00
Dinesh c915e2c6cf puppeteer_tests: Use casper's webpack setup.
As puppeteer tests are similar to casper i.e both being frontend
screen scraping tests, we need to use the same webpack setup as
that of casper's instead of `build_for_most_tests` which is used
mostly for backend related tests.

This sets env variable `CASPER_TESTS` to `1` which does all the
work to make it use the same setup of casper. We would want to
rename that to `PUPPETEER_TESTS` and make changes to do the
same as casper webpack setup when we completely replace casper
with puppeteer.
2020-05-19 15:53:59 -07:00
Dinesh 49f7355f40 tests: Create login test using puppeteer. 2020-05-19 15:52:26 -07:00
Rohitt Vashishtha da22f3b961 dropdown-list-widget: Refactor styles to use SCSS scopes. 2020-05-19 15:13:28 -07:00
Rohitt Vashishtha 96638f5bd4 dropdown-list-widget: Use null-value when no value is specified.
Previously, we tried to read the value from page_params, which was just
a hack to make the calling code look cleaner. We now remove that hack
and thus, our dependency on page_params existing. Now, if the caller
does not specify a default value, we'll use the null-value.

This also creates a new init() function to cleanly wrap the code that
makes changes to the opts passed to the widget.
2020-05-19 15:13:28 -07:00
Rohitt Vashishtha aeb247f528 dropdown-list-widget: Rename setting_name -> widget_name.
This change is another in a series of commits that allows us to use
DLW outside of realm_settings.
2020-05-19 15:13:28 -07:00
Vishnu KS 9129da88af tests: Add test for STANDARD plan_type in test_message_retention_days. 2020-05-19 14:48:59 -07:00
Vishnu KS a699f39050 models: Use UPGRADE_TEXT_STANDARD in ensure_not_on_limited_plan. 2020-05-19 14:48:59 -07:00
Vishnu KS 4e0d8953b4 models: Create ensure_not_on_limited_plan instance method. 2020-05-19 14:48:59 -07:00
Tim Abbott 196d5b8c59 docs: Add a few introductory paragraphs to our code style doc. 2020-05-19 14:22:15 -07:00
Tim Abbott ccd306d3f4 docs: Improve code style commentary on testing. 2020-05-19 14:11:53 -07:00