Commit Graph

43695 Commits

Author SHA1 Message Date
sahil839 91d2960252 confirm_dialog: Disable the cancel button also while loading.
We disable the cancel button of dialog while loading because
the action cannot be cancelled even afer clicking cancel.
2021-07-08 09:43:32 -07:00
sahil839 6b995050b0 confirm_dialog: Fix loading spinner in confirm button in night mode.
We change the color of loading indicator to black only if we are not
using night mode, and in night mode indicator remains white.
2021-07-08 09:43:32 -07:00
sahil839 cd333cf157 message_edit: Fix loading spinner in message-edit button in night mode.
We change the color of loading indicator to black only if we are not
using night mode, and in night mode indicator remains white.
2021-07-08 09:43:32 -07:00
sahil839 a3f7639af3 settings: Extract code for checking night-mode setting.
We extract the code for checking night mode setting on
the basis of color_scheme value and using matchMedia when
color_scheme is set to automatic. This is currently used
in rendering the correct logo only.

This is a prep commit for fixing loading indicator not
visible on message-edit button in night-mode.
2021-07-08 09:43:32 -07:00
Steve Howell 8ffe22fc15 slash commands: Remove /settings command.
It's easy enough for power keyboard users to just use "g"
to get to settings, and it's certainly easier for
mouse users to just go to the menu.
2021-07-08 10:47:52 -04:00
Dinesh 5f684bf119 markdown: Change timezone to time zone in <time> tooltip.
This makes it consistent with the second line.
2021-07-08 10:10:11 -04:00
Dinesh c4463ee34c test_example.py: Add a new example to demonstrate mocking.
Took the help of our mocking docs:
https://zulip.readthedocs.io/en/latest/testing/testing-with-django.html#testing-with-mocks
and rewrote a part of
test_message_edit.EditMessageTest.test_edit_message_content_limit
using mock.patch().
2021-07-08 10:04:20 -04:00
Tim Abbott c61a42615c Revert "stream_sidebar_row: Use tooltips for showing stream name on hover."
This reverts commit be240c2820.

This commit didn't get a positive reception on chat.zulip.org.
2021-07-07 21:20:15 -07:00
akshatdalton db1cf3b521 refactor: Add class `ZulipBaseHandler` to de-duplicate code. 2021-07-07 17:53:22 -07:00
Tim Abbott 718caf453e move_topic_model: Fix the line-height of dropdown-toggle button.
Our dropdown-toggle buttons are meant to have the same size as select
elements, but looked weird if you selected a stream with non-English
characters in its name.

We fix this by copying some styling details settings from our common
input/select styling.

Fixes #18479.
2021-07-07 17:46:24 -07:00
Tim Abbott 98b5f01d14 third: Prevent typeahead from going off top of screen.
This is by no means the ideal solution, since we are likely to occlude
your cursor, but it prevents the user experience from being clearly
broken.
2021-07-07 16:47:30 -07:00
Signior-X 6cf33c4275 compose: Add support for full size compose box.
This commit makes a working toggler in compose_actions that adds the
compose-fullscreen class to the compose that removes the max-height
from the compose textarea and adds flex elements above so that the
height automatically adjust with the device height. This results in
making the compose box full screen sized.

The compose_height.js maintains the state of the height of the compose
box. Also, when the compose box is closed, the compose box is reset to
it's default behaviour and original height. So, everytime user need
not toggle off the compose full size and only for specific message
it is used.

It also adds destroy autosize on compose_height state change.
It destroys the autosize of textarea when the full
screen sized compose box is toggled on. And everytime when it is
turned off, it reinitialises the autosize. This also adds a
condition in autosize_textarea to only autosize when composebox
is not in full height state.

Fixes #17660
2021-07-07 16:47:30 -07:00
Tim Abbott 739ee1d15f templates: Improve labels for the edit stream name modal. 2021-07-07 16:13:50 -07:00
Anders Kaseorg 83120f218b compose: Don’t convert absolute upload URLs to relative.
Especially not by trying to edit markdown with a context-ignorant
unescaped regexp.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-07-07 15:41:52 -07:00
Anders Kaseorg e0f4013b21 upload: Don’t convert relative upload URLs to absolute.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-07-07 15:41:52 -07:00
m-e-l-u-h-a-n 6eaf111bde message-editing: Add autocomplete suggestions for topic editing.
We extends composebox_typeahead to support autocompletion
suggestions on editing the topic of a message from message
edit form as well as from recipient bar.

Tweaked by tabbott to have correct keyboard interaction without
needing to patch Bootstrap.

Fixes: #16368.
2021-07-07 15:18:39 -07:00
Anders Kaseorg d4c8b01530 test_script: Use alphabetically first matches in find_js_test_files.
Otherwise the behavior depends on the filesystem order.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-07-07 15:14:00 -07:00
Anders Kaseorg 4a04cda956 tornado: Remove unused logger variable.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-07-07 15:13:40 -07:00
akshatdalton 11c37bca8f composebox_typeahead: Open typeahead immediately when @ is entered.
This change ensures that we pop up the typeahead when one
has entered just `@`. This will make clear to the user
about the @-mentions feature in Zulip.
This also makes us consistent with expectations from other
chatting apps like Slack, Discord, etc.

Added few test cases and modified the present ones.

Fixes: #19142.
2021-07-07 14:29:22 -07:00
Tim Abbott 572dbafd06 lint: Fix useless units on 0. 2021-07-07 12:54:21 -07:00
Priyam Seth 62d9f28211 compose_area: Fix compose_area pasted message bigger than max_length.
Fix a bug where the compose box cut the message without warning the user
the message pasted was longer than the allowed. It was fixed by stopping
cutting the message off and showing an indicator whenever the limit exceeds
and removing the indicator as soon as message gets less than that.

The cut off for showing the indicator is set as 90% of the limit.

Fixes #15909
Co-authored-by: João Maurício <carvalho.joaomauricio@gmail.com>
2021-07-07 12:18:18 -07:00
Priyam Seth e976512b3c compose: Fix compose box getting close on copying code.
This commit adds an exception in click-handlers.js so that
when mouse clicks on .copy-codeblock, the composebox is not
closed.

Fixes #19130.
2021-07-07 10:47:23 -07:00
Ganesh Pawar d6711e3cd2 muting: Add support for muting deactivated users.
Fixes #19141
2021-07-07 10:44:18 -07:00
Tim Abbott 739fcfb5aa topic links: Add tooltip explaining link.
We show the text, which is either the linkifier label or the URL
(depending what generated the topic link).

For the desktop app at least, we probably as a follow-up want to also
show the URL.

(Though maybe it'd be better to just make the desktop app display the
URL).
2021-07-07 10:33:39 -07:00
Aman Agrawal 578f93b2f3 tippy: Set default placement of tooltips to top.
Generally, tooltips placed at top look good. If the tooltip cannot
fit at top, it will by default be placed at opposite side.

Removed the unnecessary top placement definitions.
2021-07-07 10:23:31 -07:00
Aman Agrawal be240c2820 stream_sidebar_row: Use tooltips for showing stream name on hover.
We add some additional delay so that user doesn't have to see
them every time but it is the delay is short enough so that
a user can view the full name of long streams without waiting
too long.
2021-07-07 10:09:33 -07:00
Tim Abbott 5872af340f templates: Rename home.html to message_feed_errors.html.
This much more clearly expresses the purpose of the remaining content
in this page.
2021-07-07 09:47:39 -07:00
Tim Abbott c02e872545 templates: Merge core of home.html into index.html.
This makes it easier to read and understand our templates, since now
the former home.html is all error message content.
2021-07-07 09:47:39 -07:00
Tim Abbott a085954042 templates: Move main_div definition to index.html.
This will make it easier to have JavaScript render the home.html
template.
2021-07-07 09:47:39 -07:00
Tim Abbott 63a99c55b7 templates: Move notification sound elements.
These more naturally should sit at the outside of the page, not the
bottom of home.
2021-07-07 09:47:39 -07:00
Anders Kaseorg 98194b9316 blueslip: Remove SAVE_FRONTEND_STACKTRACES setting.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-07-07 09:26:02 -07:00
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