Commit Graph

49854 Commits

Author SHA1 Message Date
Anders Kaseorg da3cf5ea7a ruff: Fix RSE102 Unnecessary parentheses on raised exception.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-02-04 16:34:55 -08:00
Tim Abbott 3099487bc3 stream_popover: Remove useless old_topic_name check.
This has been present since this modal was first introduced in
b9098a42d4, but as far as I can tell, it
has never been correct. We know `old_topic_name` is not
null/undefined, since we do a check with it trimmed earlier in the
function, and there is no product reason why we would would to
silently fail to move a topic because its name was the empty string.
2023-02-03 18:20:39 -08:00
Prakhar Pratyush 9997131df3 message_edit: Fix resolve topic notifications.
When 'resolve|unresolve' and 'move stream' actions occurs in
the same api call, 'This topic was marked as resolved|unresolved'
notification is not sent.

Both 'topic moved' and 'topic resolved' notification should be generated.

This commit updates the logic of when and where to send
'topic resolve|unresolve' notification. Unlike previous logic, notification
may be sent even in the case 'new_stream' is not None.

In general, 'topic resolved|unresolved' notification is sent to
'stream_being_edited'. In this particular case ('new_stream' is not None),
notification is sent to the 'new_stream' after check.

Test case is included.

Fixes: #22973
2023-02-03 18:20:39 -08:00
Prakhar Pratyush 62437e6930 topic_edit: Fix resolve topic notification.
When 'resolve|unresolve' and 'change topic' actions occurs in
the same api call using 'topic sidebar icon', only 'topic_moved'
notification is sent.

Both 'topic moved' and 'topic resolved' notification should be generated.

Currently, 'select_stream_id' is not set to 'undefined',
even if we only change 'topic name' and/or 'resolve|unresolve' topic.
Resulting in no 'resolved_topic' notification.

This commit sets 'select_stream_id' to 'undefined' to fix the issue.
2023-02-03 18:20:39 -08:00
Prakhar Pratyush 01961b4282 stream_popover: Fix confirm button not disabled bug.
On updating the stream from the dropdown menu in the move-messages popover,
the confirm button is enabled. On changing the stream back to the initial
value, doesn't disable the confirm button. It can result in the
creation of infinite notifications.

On stream update, 'update_submit_button_disabled_state()' doesn't receive
'stream_id' as a parameter, resulting in 'undefined' stream_id,
'button.disabled' is always set to false after the first update.
2023-02-03 18:20:39 -08:00
Anders Kaseorg 8dc3e086c9 semgrep: Remove typing.Text rule superseded by Ruff UP019.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-02-03 17:37:31 -08:00
Anders Kaseorg 81a7c7502f requirements: Upgrade Python requirements.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-02-03 16:36:54 -08:00
Anders Kaseorg 5b7c4206d7 ruff: Fix SIM300 Yoda conditions are discouraged.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-02-03 16:36:54 -08:00
Anders Kaseorg b85cb1e700 exceptions: Accept lazy translation as JsonableError argument.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-02-03 16:36:54 -08:00
Anders Kaseorg b4ee94e758 readthedocs: Add a configuration file.
This overrides the settings in the web interface, and enables much
more flexible configuration of the build environment (which previously
defaulted to Python 3.7).

https://docs.readthedocs.io/en/stable/config-file/v2.html

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-02-03 16:36:54 -08:00
Tim Abbott a8ce7df649 notifications: Avoid misleading href on scroll to bottom notice. 2023-02-03 15:45:06 -08:00
evykassirer dd95f79ab7 notifications: Hide out-of-view notification once user scrolls to message.
The banner telling the user to scroll down to the message previously
didn't disappear when the user scrolled past it manually, which is
not ideal.

Keep track of which message is associated with this notification,
and clear the banner when the message scrolls above the bottom of
the viewport.
2023-02-03 15:45:06 -08:00
evykassirer e789e7aa4f compose: Leave scroll-to-message banner open until explicitly closed.
Previously the message would disappear after 300ms, but it can be
annoying for a useful link to disappear so quickly like that.

This commit removes that logic. Now the banner is closed only when
the user explicitly closes it or clicks on the link.

Note that the banner doesn't go away if the user manually scrolls
down. I still think this change is overall better, but if there's
an easy way to add that as well we should do it!

Fixes part of #19857.
2023-02-03 15:45:06 -08:00
evykassirer fbad0b273b compose: Add url to 'scroll down' sent banner.
This notification ("scroll down to view your message" with a link
for the user to click to scroll down) was added in e2c388c and
removed in 657e1f1 in a commit almost immediately afterwards.

Later the notification was added again, but there was notably no
link to scroll, just the message to scroll down. 372cb20

The link to scroll down was "added" in 1a63c2d when it was fixing
a similar link in another notification. But the implementation
didn't actually use the link (because there was no classname passed
through).

This commit adds a classname so that the link is clickable by
the user.

Fixes part of #19857.
2023-02-03 15:45:06 -08:00
Alessandro Toppi ff89590558 auth: Add JWT-based user API key fetch.
This adds a new endpoint /jwt/fetch_api_key that accepts a JWT and can
be used to fetch API keys for a certain user. The target realm is
inferred from the request and the user email is part of the JWT.

A JSON containing an user API key, delivery email and (optionally)
raw user profile data is returned in response.
The profile data in the response is optional and can be retrieved by
setting the POST param "include_profile" to "true" (default=false).

Co-authored-by: Mateusz Mandera <mateusz.mandera@zulip.com>
2023-02-03 15:23:35 -08:00
Tim Abbott 7c7ca61e9f auth: Remove now unnecessary return_data parameter. 2023-02-03 15:23:35 -08:00
Mateusz Mandera 75b44337a8 auth: Extract get_api_key_fetch_authenticate_failure. 2023-02-03 15:23:35 -08:00
Mateusz Mandera 3a1d974cee auth: Extract process_api_key_fetch_authenticate_result function.
This will be useful for re-use in the implementation of another JWT
endpoint in the upcoming commits.
2023-02-03 15:23:35 -08:00
Mateusz Mandera 100f4a7152 auth: Add @require_post to remote_user_jwt. 2023-02-03 15:23:35 -08:00
Mateusz Mandera d466da1064 auth: Use REQ for getting token value and rename param in jwt paths.
This makes us use REQ properly instead of fetching from request.POST
manually - also renaming the param to "token" which is more standard.
2023-02-03 15:23:35 -08:00
Mateusz Mandera c9c255b3a8 auth: Improve JsonableError in get_..._jwt_authentication_request. 2023-02-03 15:23:35 -08:00
Mateusz Mandera 6c638a1057 auth: Extract token-check logic of remote_user_jwt.
This will be useful for re-use for implementation of an endpoint for
obtaining the API by submitting a JWT in the next commits.

It's not a pure refactor, as it requires some tweaks to remote_user_jwt
behavior:
1. The expected format of the request is changed a bit. It used to
   expect "user" and "realm" keys, from which the intended email was
   just generated by joining with @. Now it just expects "email"
   straight-up. The prior design was a bt strange to begin with, so this
   might be an improvement actually.
2. In the case of the codepath of new user signup, this will no longer
   pre-populate the Full Name in the registration form with the value
   from the "user" key. This should be a very minor lost of
   functionality, because the "user" value was not going to be a proper
   Full Name anyway. This functionality can be restored in a future
   commit if desired.

This is an API change, but this endpoint is nearly unused as far as
we're aware.
2023-02-03 15:23:35 -08:00
Sahil Singh dd85e8b4f5 settings: Fix emoji image preview with wide images.
The image preview in the 'upload_widget' would scale images that are
wider than the intended square shape for custom emoji; this resulted
in a misleading preview, because the server will instead crop such
images to take their leftmost square.

Fix this using 'object-fit: cover', to have the browser do something
similar.
2023-02-03 11:47:19 -08:00
Sahil Singh 0870ad5d14 settings: Preview bot avatar in bot editing/creation forms.
Previews of the current bot avatar and the uploaded bot avatar were not
displayed during bot creation or editing.

We address this by extending The 'upload_widget' component with with
'preview_text' and 'preview_image' parameters to provide a preview of
the image that will be used as the bot's avatar during bot creation or
editing.

Fixes #23023.
2023-02-03 11:47:19 -08:00
Tim Abbott 8d27d14354 models: Improve documentation for FOLLOWED UserTopics. 2023-02-03 11:25:05 -08:00
Aman Agrawal c3f0d5898a index: Remove `Loading...` text from the app loading overlay.
The new loading spinner animation conveys the message well
that the app is loading and this text is no longer required.
2023-02-03 10:51:39 -08:00
Brijmohan Siyag 6b0265a239
index: Load Zulip logo for loading indicator as inline svg.
Fetching an external SVG doesn't work, since the whole point of this
screen is to be displayed while we're waiting for external resources to load.
2023-02-03 10:48:00 -08:00
Lauryn Menard dbacc00f0f api-docs: Move markdown files to top level directory.
- Updates `.prettierignore` for the new directory.
- Updates any reference to the API documentation directory for
  markdown files to be `api_docs/` instead of `zerver/api/`.
- Removes a reference link from `docs/documentation/api.md` that
  hasn't referenced anything in the text since commit 0542c60.
- Update rendering of API documentation for new directory.
2023-02-02 17:25:40 -08:00
Lauryn Menard fc54ffd778 documentation: Move check for `api-doc-template.md`.
Moves the check for calling the `api-doc-template.md` directly,
so that we don't return a 500 error from the server, to happen
earlier with other checks for returning a 404 / missing page.

Also adds a specific test to `zerver/tests/test_urls` for this
template.

Prep commit for moving API documentation directory to be a top
level directory.
2023-02-02 17:23:31 -08:00
evykassirer aaa8b90271 compose: Increase click target area around banner close button.
Using padding instead of margin allows a wider area around
the button where the user can click from to still functionally
click the button.
2023-02-02 17:21:24 -08:00
Alya Abbott 27b703f617
emails: Improve followup_day1 (registration confirmation) email.
- Clean up the language.
- Add a prominent "Go to organization" button.
- Link to guides for new users and admins.
- Fix duplication bug in text email version.

Co-authored-by: Mateusz Mandera <mateusz.mandera@zulip.com>
2023-02-02 17:16:43 -08:00
Alex Vandiver a8d0908893 tail-ses: Support noreply address of `Real Name <noreply@example.com>`. 2023-02-02 11:33:40 -08:00
Alex Vandiver 98711b0e45 tail-ses: Set AWS region based on S3_REGION value. 2023-02-02 11:33:40 -08:00
Ganesh Pawar b7335d0dec custom_emoji: Convert inline form to modal.
Fixes part of #21298.
2023-02-02 10:59:57 -08:00
Anders Kaseorg df001db1a9 black: Reformat with Black 23.
Black 23 enforces some slightly more specific rules about empty line
counts and redundant parenthesis removal, but the result is still
compatible with Black 22.

(This does not actually upgrade our Python environment to Black 23
yet.)

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-02-02 10:40:13 -08:00
SameepAher bbf5b3d6ce popovers: Link subscribed users to user cards.
This links users or bots in Stream settings -> Subscribed users, to
their respective user profile card.

Also, changes were made to close any active overlay, on clicking any of
the PM buttons in the user profile card. This help us avoid writing
separate conditions for multiple overlays, like settings overlay or
stream settings overlay.

Fixes part of #18880.
2023-02-01 16:07:03 -08:00
N-Shar-ma db7d2169b3 left_sidebar: Space PM / topic / stream names from icons on right by 3px.
Due to some quirks of CSS specificity, a rule for 0 `right-padding` was
overriding a rule for 2px `right-padding` for topic names.

This is now corrected, and the padding increased to 3px for a less
cramped look, for PMs, topics and streams. Repetition of CSS has also
been removed.
2023-02-01 16:04:33 -08:00
Sahil Batra 4ea64cfede settings: Remove 'bootstrap-focus-style' from div element.
This commit fixes the code to add 'bootstrap-focus-style'
class to select element instead of div.

This was introduced in af36e9f823.
2023-02-01 14:50:30 -08:00
Prashant Vithani a791c817c7
css: Fix erroneous `bootstrap-focus-style` ID.
The commit af36e9f added a bug that breaks new user invite.
The CSS class ` bootstrap-focus-style` was added to `id`,
hence breaking the value extraction.

Fixes: #24249
2023-02-01 14:49:55 -08:00
Sahil Batra a2315422e7 settings: Override bottom margin for inputs.
We override the bottom margin added by bootstrap for
url type custom profile input in user profile page
and all the inputs in edit-user form. Previously, this
was handled by form-horizontal class which was removed
in #24057.

For most of the other text-type inputs, it is overridden
in app_components.css and for checkbox-type inputs, it is
overridden by other bootstrap CSS itself. But that only
handles text-type and checkbox-type inputs inside
".new-style" element and not url type inputs.
Some other inputs already have specific CSS to override the
bootstrap CSS.

For the same reason, there is no need to override bottom
margin for inputs in organization profile as there is no
url type inputs in that page and this commit removes the
CSS for it.
2023-02-01 14:48:48 -08:00
Lauryn Menard e6bfdc7d34 settings: Create shared class for tooltips on disabled settings.
Creates a shared `disabled_setting_tooltip` class that can be
reused in cases where a personal or organization setting button
or input is disabled and a tooltip is added to give information
about why the user cannot change/access the setting.
2023-02-01 14:46:02 -08:00
Lauryn Menard d8b8b34ecd profile-settings: Change `name-input` class to a more specific id.
Changes `name-input` class, that was only being used in a div
wrapper for the input element for changing a user's full name,
to be a more specific id name: `full_name_input_container`.

This id is used to set or remove the disabled setting tooltip
when name changes are disabled by the organization.

There are no CSS rules set with this class/id.
2023-02-01 14:46:02 -08:00
Lauryn Menard 264a34d543 settings-css: Combine rules for disabled button `pointer-events`. 2023-02-01 14:46:02 -08:00
Alex Vandiver 26696aaa53 upgrade-postgresql: Also upgrade postgresql-client.
The `pg_upgrade` tool uses `pg_dump` as an internal step, and verifies
that the version of `pg_upgrade` is the same exactly the same as the
version of the PostgreSQL server it is upgrading to.  A mismatch (even
in packaging versions) leads to it aborting:

```
/usr/lib/postgresql/14/bin/pg_upgrade -b /usr/lib/postgresql/13/bin -B /usr/lib/postgresql/14/bin -p 5432 -P 5435 -d /etc/postgresql/13/main -D /etc/postgresql/14/main --link
Finding the real data directory for the source cluster      ok
Finding the real data directory for the target cluster      ok

check for "/usr/lib/postgresql/14/bin/pg_dump" failed: incorrect version: found "pg_dump (PostgreSQL) 14.6 (Ubuntu 14.6-0ubuntu0.22.04.1)", expected "pg_dump (PostgreSQL) 14.6 (Ubuntu 14.6-1.pgdg22.04+1)"
Failure, exiting
```

Explicitly upgrade `postgresql-client` at the same time we upgrade
`postgresql` itself, so their versions match.

Fixes: #24192
2023-02-01 14:44:34 -08:00
Aman Agrawal c64c00d916 portico_signin: Wrap long email names to next line.
Along with wrapping long emails to next line, set the max-width of
the email confirmation box to the alert box.
2023-02-01 13:14:08 -08:00
Lauryn Menard b64d8e8a52 templates: Remove `base_path` argument from api_arguments_table_generator.
Removes `base_path` argument when making the markdown extension for
parameters in documentation for API endpoints.

This seems to have been originally included for API parameters that
were documented in JSON files, which is no longer in use. Now all
API endpoints in the documentation are documented in
`zerver/openapi/zulip.yaml`.
2023-02-01 13:12:53 -08:00
Lauryn Menard f38d5a6a26 templates: Remove `base_path` argument from api_return_values_generator.
Removes `base_path` argument when making the markdown extension for
return values in documentation for API endpoints.

This seems to have been a copy and paste error in commit d2ee99a2fd
when `zerver/lib/markdown/api_return_values_generator.py` was created.
2023-02-01 13:12:53 -08:00
Lauryn Menard 20fb9af974 help: Add redirect for `help/configure-default-view`.
Adds URL redirect that was missed in commit 73710e1cf0 when
`change-default-view.md` was renamed to `configure-default-view.md`.
2023-02-01 06:10:14 -08:00
Lalit 4ab824dc4c
emoji: Disallow `.` in custom emoji names.
Until now, custom emojis with "periods" in their name were allowed, even though
they don't really fit the pattern of how we name them, and in fact the Markdown
processor would not render such custom emoji. Fix this by just disallowing the
character.

Also update the error strings accordingly.

Note that this does not include a migration to eliminate any existing custom emoji with this 
character in their name.

Fixes #24066.
2023-01-31 17:28:33 -08:00
Tim Abbott 875ad8ed5b compose: Fix using Up when editing messages.
This fixes a very noticable regression in
92788a52bb, where using Up/PageUp/Home
when focus was in anything other than the compose box would
incorrectly be treated as message feed navigation.

Fix this by adding a new check, but this now has some fairly
duplicated code that queries the DOM for the same thing 3 times in a
row; added a TODO comment explaining a likely better approach.
2023-01-31 17:24:50 -08:00