Commit Graph

43764 Commits

Author SHA1 Message Date
Anders Kaseorg 07fef56c74 logging_handlers: Remove STAGING_ERROR_NOTIFICATIONS setting.
Running notify_server_error directly from the logging handler can lead
to database queries running in a random context.  Among the many
potential problems that could cause, one actual problem is a
SynchronousOnlyOperation exception when running in an asyncio event
loop.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-07-07 09:26:02 -07:00
Mateusz Mandera 58d9975cca embed_links: Interrupt consume() function on worker timeout.
This fixes a bug introduced in 95b46549e1
which made the worker simply log a warning about the timeout and then
continue consume()ing the event that should have also been interrupted.

The idea here is to introduce an exception which can be used to
interrupt the consume() process without triggering the regular handling
of exceptions that happens in _handle_consume_exception.
2021-07-07 09:24:50 -07:00
Mateusz Mandera cee4da64fa saml: Don't raise AssertionError if no name is provided in SAMLResponse.
This is an acceptable edge case for SAML and shouldn't raise any errors.
2021-07-07 09:23:21 -07:00
Signior-X 5a61c9bb14 compose: Convert pasted url to named link.
This commit changes the pastehandler to have a case when
a url is tried to paste on composebox. It instead of
directly pasting it, changes the content as we do using
ctrl + shift + L, just the difference is here it uses,
the copied text instead of url and cursor moves forward.

Fixes #18692
2021-07-06 17:56:02 -07:00
Signior-X 3bdc7432b9 refactor: Move wrap_text_with_markdown into compose_ui.js.
This commit makes it possible to use wrap_text_with_markdown_outside
compose.js.

Part of #18692
2021-07-06 17:55:58 -07:00
Tim Abbott 2cb1be096e ui_init: Fix order of realm_logo rendering.
This needs to run after the navbar has been initialized.  Bug caught
by our puppeteer tests.
2021-07-06 17:51:00 -07:00
Vishnu KS 4ad592ed4f populate_db: Use do_create_realm for creating zulip realm.
Since do_create_realm also creates general and core team streams,
we rename general to verona right after the realm is created. Mostly
because we dont really want two additional streams and this might
probably make it easy to review things.

There are puppeteer test changes because, we have a new "core team"
stream in tests as well as there is a new default notification stream
"Verona". Because of this tests in message-basics for example have
to be changed since the newly added core team affects the order in
which we navigate through the streams using arrow keys.

The extra await for selector was added in subscriptions test to make
the tests wait. Without the await the tests were passing ocassionally
and failing in some other times.

Fixes #6967
2021-07-06 17:37:43 -07:00
Vishnu KS 0e554a6400 populate_db: Use do_create_realm for creating lear realm. 2021-07-06 17:22:00 -07:00
Vishnu KS acffc0ae0a populate_db: Use do_create_realm for creating zephyr realm. 2021-07-06 17:22:00 -07:00
Vishnu KS b9066886d9 cache: Properly flush stream from cache after the stream is deleted.
The previous logic was incorrect and was not flushing the stream from
cache after deletion.

```

stream = get_realm_stream("Verona", realm.id)
stream.delete()
get_realm_stream("Verona", realm.id)
```

In the above example, the last line of code would have returned
the stream from cache instead of throwing a Stream.DoesNotExist
error. This is fixed in the commit.

I have verified that this commit indeed fix the issue by verifying
that calling get_realm_stream again after deleting the stream
results in Stream.DoesNotExist error.
2021-07-06 17:21:59 -07:00
aryanshridhar c6828767fa navbar: Migrate to handlebars.
This commit migrates the `navbar.html` Django template
to handlebars by creating a new file as `navbar.hbs`
within `/static/templates` which is then rendered
using `ui_init` module.

As a part of migration, we also remove the `search_pills_enabled`
and `embedded` parameters from the context attribute as they
are no longer needed now.

Fixes part of #18792.
2021-07-06 16:46:50 -07:00
Priyansh Garg 3294e8dbe0 compose-box: Insert quoted content at the cursor position.
Right now, on clicking `quote and reply` on any message, the quoted
message is always inserted at the top of compose-box irrespective of
the current cursor position. Also, after insertion of the quoted
message, the cursor is shifted at the end of the compose box.

This commit changes this behaviour to insertion of quoted message
at the current cursor position with a newline at the end of quote
and moving the cursor position to that newline after insertion.
A newline is added at the beginning of quoted message only if there
was some content already present in compose box before the previous
cursor position.

Tested on Google Chrome and Firefox browsers on Ubuntu dev environment.

Fixes: #16836
2021-07-06 16:38:17 -07:00
Anders Kaseorg 604f6c491c webpack: Fix webpack-bundle-tracker hot update bug.
https://github.com/django-webpack/webpack-bundle-tracker/pull/101

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-07-06 15:53:48 -07:00
Tim Abbott 3fdfbb27f9 streams: Clean up compose_views logic.
Now that we're not using json_error and instead raising an exception,
we don't need this special logic to try to reraise an exception.
2021-07-06 15:36:39 -07:00
PIG208 8b9011dff8 json_error: Completely remove json_error.
This completes the migration from `return json_error` to
`raise JsonableError`.
2021-07-06 15:34:33 -07:00
Tim Abbott dbf886dfce exceptions: Deduplicate common authentication errors. 2021-07-06 15:28:38 -07:00
Tim Abbott 331f34cc1f auth: Use standard classes for API key fetch exceptions.
This lets us reuse a bunch of code and error handling logic, resulting
in a more sensible and consistent API.
2021-07-06 15:28:38 -07:00
akshatdalton ea4587071a tooltip: Improve tooltip placement for search users icon in right sidebar.
Similar to the previous commit, the tooltip was not
completely visible in this case and this bug was
similar to the one corrected in recipient bar icons.
2021-07-06 15:26:53 -07:00
akshatdalton d693b77f49 tooltip: Improve tooltip placement for User sidebar title.
Here, the tooltip was partially visible. This bug was similar
to the one that is corrected for recipient bar icons.

I have removed the class attribute `tippy-zulip-tooltip`
for Filter stream title as this will be handled by the
new changes.
2021-07-06 15:26:53 -07:00
sahil839 8fe401c38c confirm_dialog: Rename confirm_dialog_yes_button class.
This commit renames confirm_dialog_yes_button class to
confirm_dialog_submit_button. This will help in keeping
a general class name when deduplicating the code for
confirm_dialog and edit_fields_modal.
2021-07-06 15:15:50 -07:00
sahil839 055d7113f2 confirm_dialog: Rename html_yes_button to html_submit_button.
This commit renames the html_yes_button parameter of confirm
dialog widget to html_submit_button and also all the related
variables in confirm_dialog.js.
This will help in keeping a general name when deduplicating
the code for confirm_dialog and edit_fields_modal.
2021-07-06 15:15:50 -07:00
sahil839 eaf69bbf16 edit_fields_modal: Show error message in the body not heading.
Placing error message at the top of the body looks better than
placing it below the heading.
2021-07-06 15:15:50 -07:00
sahil839 0ebcb17397 confirm_dialog: Change the style and position of error message element.
This commit changes the error message element of confirm_dialog to be
above the text of dialog and to be a nice box using already defined
"alert" class.
2021-07-06 15:15:50 -07:00
sahil839 19362f393e edit_fields_modal: Rename modal_body_html and modal_label.
This commit renames modal_body_html and modal_label to
html_body and html_heading respectively. This change
will help us easily deduplicating the confirm_dialog
and edit_fields_modal code.
2021-07-06 15:15:50 -07:00
sahil839 0edb413121 css: Remove unused css.
This was missed in 98bb0f7b2.
2021-07-06 15:15:50 -07:00
Priyam Seth ba44f4161a compose: Make a function to hide compose error.
This commit creates compose_error.hide() function that
can be used to hide compose_error alerts.
2021-07-06 15:15:26 -07:00
Tim Abbott bcc07b918a css: Set night theme font CSS on loading page. 2021-07-06 14:57:17 -07:00
nooblag 3d66914cca minor: Introduce color logo on loading page.
With a few small styling tweaks from tabbott.

Fixes #18890.
2021-07-06 14:56:02 -07:00
Tim Abbott ac568d303c test_queue_worker: Fix order-dependent assertions. 2021-07-06 14:37:16 -07:00
Mateusz Mandera 95b46549e1 embed_links: Only log warning if worker times out.
Throwing an exception is excessive in case of this worker, as it's
expected for it to time out sometimes if the urls take too long to
process.

With a test added by tabbott.
2021-07-06 14:17:24 -07:00
Mateusz Mandera d9ab70bdde queue_processors: Make timer_expired receive list of events as argument.
This will give queue workers more flexibility when defining their own
override of the method.
2021-07-06 13:46:48 -07:00
Mateusz Mandera c101f3acd6 queue_processors: Make timer_expired() a method.
This allows specific queue workers to override the defaut behavior and
implement their own response to the timer expiring. We will want to use
this for embed_links queue at least.
2021-07-06 13:46:48 -07:00
sahil839 c13f0626e3 tests: Use the list in models.py directly in do_test_realm_update_api.
The list of possible values of all settings was re-defined in
do_test_realm_update_api and we can instead use the list defined
in models.py which is used to validate values in views/realm.py.

There is no problem in order of values as we always initialize the
first value of the list.

This has also added some more values to test for a couple of
settings as a result.
2021-07-06 13:45:01 -07:00
sahil839 b4a0a33f4c tests: Test all values in the list in do_test_realm_update_api.
This commit changes do_test_realm_update_api to test all values
in the list of a given setting instead of checking only two
values.
2021-07-06 13:45:01 -07:00
sahil839 8314620314 tests: Change test_change_realm_default_language to test invalid value.
We change the test_change_realm_default_language to test only invalid
value and rename it to test_invalid_realm_default_language, because
we already test whether the value is changed correctly or not in
do_test_realm_update_api.
2021-07-06 13:45:01 -07:00
sahil839 6a3a07a359 tests: Remove test_change_bot_creation_policy from test_realm.py.
This commit removes test_change_bot_creation_policy which is used
to test changing bot_creation_policy using 'PATCH /realm' endpoint
as we already do this in do_test_realm_update_api and invalid value
is also tested in test_invalid_integer_attribute_values.
2021-07-06 13:45:01 -07:00
sahil839 77471a5b44 tests: Remove test_change_email_address_visibility from test_realm.py.
This commit removes test_change_email_address_visibility which is used
to test changing email_address_visibility using 'PATCH /realm' endpoint
as we already do this in do_test_realm_update_api and invalid value is
also tested in test_invalid_integer_attribute_values.
2021-07-06 13:45:01 -07:00
sahil839 74023bfacf tests: Remove test_change_invite_to_stream_policy from test_realm.py.
This commit removes test_change_invite_to_stream_policy which is used
to test changing invite_to_stream_policy using 'PATCH /realm' endpoint
as we already do this in do_test_realm_update_api and invalid value
is also tested in test_invalid_integer_attribute_values.
2021-07-06 13:45:01 -07:00
sahil839 99e5058bd6 tests: Remove test_change_invite_to_realm_policy from test_realm.py.
This commit removes test_change_invite_to_realm_policy which is used
to test changing invite_to_realm_policy using 'PATCH /realm' endpoint
as we already do this in do_test_realm_update_api and invalid value
is also tested in test_invalid_integer_attribute_values.
2021-07-06 13:45:01 -07:00
sahil839 1c0e67e7c4 tests: Remove test_change_move_messages_between_streams_policy.
This commit removes test_change_move_messages_between_streams_policy
which is used to test changing move_messages_between_streams_policy
using 'PATCH /realm' endpoint as we already do this in
do_test_realm_update_api and invalid value is also tested in
test_invalid_integer_attribute_values.
2021-07-06 13:45:01 -07:00
sahil839 8831fb22b1 tests: Remove test_user_group_edit_policy from test_realm.py.
This commit removes test_user_group_edit_policy which is used
to test changing user_group_edit_policy using 'PATCH /realm'
endpoint as we already do this in do_test_realm_update_api and
invalid value is also tested in test_invalid_integer_attribute_values.
2021-07-06 13:45:01 -07:00
sahil839 a1e6cbdc80 tests: Remove test_private_message_policy from test_realm.py.
This commit removes test_private_message_policy which is used to
test changing private_message_policy using 'PATCH /realm' endpoint
as we already do this in do_test_realm_update_api and invalid
value is also tested in test_invalid_integer_attribute_values.
2021-07-06 13:45:01 -07:00
sahil839 f95faaf732 tests: Remove test_change_wildcard_mention_policy from test_realm.py.
This commit removes test_change_wildcard_mention_policy which is
used to test changing wildcard_mention_policy using 'PATCH /realm'
endpoint as we already do this in do_test_realm_update_api and
invalid value is also tested in test_invalid_integer_attribute_values.
2021-07-06 13:45:01 -07:00
sahil839 8e26f920ab tests: Remove test_change_stream_creation_policy from test_realm.py.
This commit removes test_change_stream_creation_policy which is
used to test changing create_stream_policy using 'PATCH /realm'
endpoint as we already do this in do_test_realm_update_api and
invalid value is also tested in test_invalid_integer_attribute_values.
2021-07-06 13:45:01 -07:00
Eeshan Garg ef6582edb8 readthedocs: Add proper backlink to the Zulip homepage.
Now that we are starting to link this pages from the landing page's
top navigation, it makes sense to have proper backlinks to the
homepage so that there is some continuity when the user clicks on
a link that takes them to a ReadTheDocs page from the main website.
2021-07-06 10:59:59 -07:00
Tim Abbott fc0035f050 portico: Stop using 0.5 opacity for documentation titles.
opacity 0.5 is pretty hard to read.
2021-07-06 10:37:44 -07:00
Eeshan Garg 5a94bfcb88 docs: Add proper backlink to the homepage from /help and /api.
Currently, the "Home" link at the top takes one to the doc root,
i.e., /help or /api. This is a little misleading since "Home"
seems to be more synonymous with the Zulip homepage.

This commit adds a proper backlink to the top logo that takes you to
the homepage and renames "Home" to be more specific. The text after
"|" will now take you to the doc root instead (/help or /api). Note
that this allows us to link the /help and /api pages from the
homepage while ensuring that backlinks allow the visitor to get back
to the homepage.
2021-07-06 10:35:41 -07:00
Suyash Vardhan Mathur e9189d63ab apidocs: Remove template of get-events.
Now, get-events template fits the standard
format of the api docs template, and so the
redundant markdown template can be deleted to
generate the page diretly from openapi data.
2021-07-06 10:17:50 -07:00
Suyash Vardhan Mathur acb1244f93 api docs: Move stray get_events Python example.
We also remove the call_on_each_event note, which has been misplaced
ever since we created the "real-time-events" page.
2021-07-06 10:17:03 -07:00
Suyash Vardhan Mathur 7bbafbc881 python_examples: Add auto-rendering of extra imports.
Currently, there is no provision of rendering
additional imports automatically, and those examples
were hardcoded in the templates.

This commit adds an openapi parameter
to store the additional imports required for the endpoint.
Further, it changes code to replace `import zulip`
with the modified imports.
2021-07-06 10:14:46 -07:00