Commit Graph

18484 Commits

Author SHA1 Message Date
Anders Kaseorg 5af8dfda3e ruff: Fix FURB167 Use of regular expression alias.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-06-30 22:37:15 -07:00
Anders Kaseorg 6a73006723 ruff: Fix FURB105 Unnecessary empty string passed to `print`.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-06-30 22:37:15 -07:00
Prakhar Pratyush fb5b721421 onboarding_step: Don't show 'visibility_policy_banner' to new users.
Earlier, a one-time 'visibility_policy_banner' was displayed to
existing as well as new users to inform them about the new
"follow/unmute topics" feature.

It makes sense to educate only the existing Zulip users about
the new feature using this banner. New users don't need to know
about following topics right away.

This commit makes changes to NOT show the banner to new users.

This will also help to avoid banner overload in the new user
experience.

Fixes #30615.
2024-06-28 10:41:48 -07:00
Vector73 43eb591ed6 api_docs: Rename titles of endpoint docs and add missing links.
Renames titles of endpoints to make them consistent across left sidebar and
main documentation page.

Adds missing links in API documentation.
2024-06-28 10:07:27 -07:00
Lauryn Menard e68da43b67 api-docs: Update /users/me/presence documentation.
Revises descriptive text for this endpoint to be clearer and more
robust.

Fixes issues with the rendering of the modern and legacy formats
for the user presence data.
2024-06-27 19:15:08 -07:00
Lauryn Menard ae4ba8761c api-docs: Update "presences" object description in register response.
Updates the description for `slim_presence` parameter as it relates
to the `presences` object that's returned in the response.

Adds the modern format for the `presences` object in the response
as that is what will be returned when the parameter above is True.
2024-06-27 19:15:08 -07:00
Lauryn Menard d66ee33859 api-docs: Add ModernPresenceFormat schema. 2024-06-27 19:15:08 -07:00
Lauryn Menard 22fcf6cede api-docs: Rename Presence schema to LegacyPresenceFormat. 2024-06-27 19:15:08 -07:00
Anders Kaseorg b115d44b6a requirements: Upgrade Python requirements.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-06-27 15:31:43 -07:00
Anders Kaseorg 997dbcd5d9 clubhouse: Fix PLR1704 Redefining argument with the local name `action`.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-06-27 15:31:43 -07:00
Anders Kaseorg 9fdc0eeb8e scim: Fix PLR1704 Redefining argument with the local name `path`.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-06-27 15:31:43 -07:00
Tim Abbott 47db96d730 migrations: Add migration for RealmAuditLog ordering.
Because this might impact how past RealmAuditLog-reading migrations
are processed, I think it's better to this one as an actual Django
migration, even though it has no actual SQL to run.
2024-06-26 17:18:50 -07:00
Lauryn Menard 673a01ea0c realm-deactivation: Send email to owners as part of deactivation.
Creates a new "realm_deactivated" email that can be sent to realm
owners as part of `do_deactivate_realm`, via a boolean flag,
`email_owners`.

This flag is set to `False` when `do_deactivate_realm` is used for
realm exports or changing a realm's subdomain, so that the active
organization owners are not emailed in those cases.

This flag is optional for the `deactivate_realm` management command,
but as there is no active user passed in that case, then the email
is sent without referencing who deactivated the realm.

It is passed as `True` for the support analytics view, but the email
that is generated does not include information about the support
admin user who completed the request for organization deactivation.

When an active organization owner deactivates the organization, then
the flag is `True` and an email is sent to them as well as any other
active organization owners, with a slight variation in the email text
for those two cases.

Adds specific tests for when `email_owners` is passed as `True`. All
existing tests for other functionality of `do_deactivate_user` pass
the flag as `False`.

Adds `localize` from django.util.formats as a jinja env filter so
that the dates in these emails are internationlized for the owner's
default language setting in the "realm_deactivated" email templates.

Fixes #24685.
2024-06-26 16:48:18 -07:00
Alex Vandiver 2eaf098c5d upload: Content-type is always defined. 2024-06-26 16:43:11 -07:00
Alex Vandiver 17fb23746f upload: Move methods into zerver.lib.upload from .base. 2024-06-26 16:43:11 -07:00
Alex Vandiver c826d80061 upload: Factor out common code into zerver.lib.upload. 2024-06-26 16:43:11 -07:00
Alex Vandiver c0d9a95aa8 email_mirror: Fix a misleading variable name. 2024-06-26 16:43:11 -07:00
Alex Vandiver 5cd10ce51d s3: Allow setting a CloudFront URL prefix for avatar and emoji images. 2024-06-26 16:43:11 -07:00
Alex Vandiver 08b24484d1 upload: Remove redundant acting_user_profile argument.
This argument, effectively added in 9eb47f108c, was never actually
used.
2024-06-26 16:43:11 -07:00
Alex Vandiver 41d1b417e7 avatars: Clean up now-irrelevant assumptions.
This x=x hack was removed in 3bd3173b1f.
2024-06-26 16:43:11 -07:00
Alex Vandiver fb929ca218 thumbnailing: Remove unnecessary third return value from resize_emoji. 2024-06-26 16:43:09 -07:00
Alex Vandiver 0070b5da78 tests: Switch from PIL to pyvips. 2024-06-26 16:42:59 -07:00
Alex Vandiver b14a33c659 thumbnailing: Switch to libvips, from PIL/pillow.
This is done in as much of a drop-in fashion as possible.  Note that
libvips does not support animated PNGs[^1], and as such this
conversion removes support for them as emoji; however, libvips
includes support for webp images, which future commits will take
advantage of.

This removes the MAX_EMOJI_GIF_SIZE limit, since that existed to work
around bugs in Pillow.  MAX_EMOJI_GIF_FILE_SIZE_BYTES is fixed to
actually be 128KiB (not 128MiB, as it actually was), and is counted
_after_ resizing, since the point is to limit the amount of data
transfer to clients.

[^1]: https://github.com/libvips/libvips/discussions/2000
2024-06-26 16:42:57 -07:00
Alex Vandiver 9fb03cb2c7 upload: Factor out common avatar logic. 2024-06-26 16:38:01 -07:00
Alex Vandiver d92993c972 upload: Factor out common emoji logic. 2024-06-26 16:38:01 -07:00
Alex Vandiver 872e2ad2cd models: Enforce an ordering to on audit logs to solve a flaky test.
Multiple events may be created with the same timestamp; we add a
default ordering by "id" such that these have a consistent ordering in
tests (to solve for flaky tests), as well as in the internal API.
2024-06-26 16:38:00 -07:00
Lauryn Menard d356577c29 api-docs: Add example for BigBlueButton meeting_name parameter.
Also adds a link to the BigBlueButton integration documentation in
the endpoint's main description.
2024-06-26 10:04:09 -07:00
Vector73 6aa3a55796 openapi: Reorder group-setting-value oneOf clause. 2024-06-25 15:37:31 -07:00
Vector73 b285e631e9 api_docs: Fix missing content from API documentation. 2024-06-25 15:37:31 -07:00
Kenneth Rodrigues 29cbdd5050 documentation: Convert to typed_endpoint. 2024-06-25 11:07:03 -07:00
Prakhar Pratyush 1b9143b511 onboarding: Update message contents to use triple quotes.
This commit updates the message contents to use triple quotes.

It helps to maintain a consistent pattern for multi-line strings
in 'zerver/lib/onboarding.py' file and it'll be a lot more
convenient to edit in that form in the future.
2024-06-24 10:44:30 -07:00
Lauryn Menard 3f8d5ea0ab api-docs: Update message_ids description in update_message event.
Clarifies that the ID of the edited message will always be included
in the `message_ids` list, even if there are no topic or channel
updates to be made.
2024-06-24 10:36:49 -07:00
Sahil Batra b44d30add7 events: Optimize computing can_create_streams and related fields.
Currently, for computing fields like can_create_public_streams
and can_create_private_steams fields, is_user_in_group is called
to check whether the user is part of the group which has the
permission. This means that there will be one DB query for each
field.

To optimize this, we now first fetch all the groups that the
user is member of, including the anonymous groups which are
used for settings, such that we can then just check whether
the user is part of the group which has the permission meaning
we would need only one query to compute all the fields.

This would be helpful when settings for other similar fields
will also be migrated to groups framework.
2024-06-24 10:00:08 -07:00
Mateusz Mandera 9f24b30e78 test_push_notifs: Adjust .filter() in test_analytics_api.
The test asserts entries about the zephyr realm anyway. The reason the
filter hasn't been limiting the query to zephyr is that we might
simultaneously want to ensure no other realms received changes - but
that doesn't seem quite right, given that the test doesn't dilligently
set up the initial conditions for all realms to have control over what
exactly happens with them. That makes this logic pretty fragile since if
some new (potentially unrelated) changes to Realm/RemoteRealm initial
state make it so some updates to other realms occur during the early
analytics upload calls in the test, the remote_audit_logs asserts here
will break in a very annoying to debug way.

If we want this query to be general, without limiting to the zephyr
realm, we could alter the test a bit to set up initial conditions
precisely.
2024-06-23 07:44:11 -07:00
Mateusz Mandera f8616fa013 analytics: Send ZULIP_MERGE_BASE to the bouncer. 2024-06-23 07:44:11 -07:00
Anders Kaseorg f7eecb0e03 sentry: Untangle from page_params.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-06-22 18:53:56 -07:00
tnmkr 9af71c690f custom_profile_fields: Fix "required" field in OpenAPI documentation.
This is not an optional field and should be present in all API responses
of custom profile field object.
2024-06-21 16:32:15 -07:00
tnmkr b6231f5568 zulip.yaml: Fix typo in IncludeCustomProfileFields description. 2024-06-21 16:32:15 -07:00
Vector73 5230aada2b python_examples: Validate error responses.
Adds assert statements to validate error response for "400" error code. The
current validation using `validate_against_openapi_schema` doesn't work for
"400" responses.

Adds separate functions to validate "200" and "400" responses and removes `validate_response_result`.
2024-06-21 09:49:07 -07:00
Alex Vandiver be9369541a create_user: Copy the avatar before announcing it. 2024-06-20 23:06:08 -04:00
Alex Vandiver 35f8c3c455 avatar: Clean up one callsite of deprecated avatar_url_from_dict. 2024-06-20 23:06:08 -04:00
Alex Vandiver 3ce06361c8 models: Document UserProfile.avatar_hash as LDAP-only. 2024-06-20 23:06:08 -04:00
Alex Vandiver 0153d6dbcd thumbnailing: Move resizing functions into zerver.lib.thumbnail. 2024-06-20 23:06:08 -04:00
Alex Vandiver 2c5dff7f59 thumbnailing: Remove unnecessary os.path adjustment.
This is a library file, not a binary; os.path is already set up.
2024-06-20 23:06:08 -04:00
Alex Vandiver 846cffe2fa name_restrictions: Reserve "avatar". 2024-06-20 23:06:08 -04:00
Sahil Batra 6164a41864 realm: Remove create_private_stream_policy setting.
This commit removes create_private_stream_policy setting as
we now use new group based setting.

The "/register" response includes realm_create_private_stream_policy
field to return a value representing superset of users who have the
permission to create private channels, as older clients still expect
this field.
2024-06-20 15:48:14 -07:00
Sahil Batra 0bae59fa4b streams: Check permission to create channels based on group setting.
This commit updates code to use new group based setting when
checking permission to create private channels.
2024-06-20 15:48:14 -07:00
Sahil Batra 27171d103e realm: Add new group setting for who can create private channels.
This commit adds new group based setting to control who can create
private channels.
2024-06-20 15:48:14 -07:00
Sahil Batra 428d4284f9 users: Update has_permission to accept realm as argument.
This commit helps in using the realm object which has the
prefetched group settings so that we can avoid extra queries
when calculating fields like can_create_public_streams.
2024-06-20 15:48:14 -07:00
Sahil Batra 048221212e realms: Do not prefetch settings in get_realm.
There is no need to prefetch group settings using select_related
in get_realm as we only need to save queries when computing the
setting values in fetch_initial_state_data and we already refetch
the realm using get_realm_with_settings for that.
2024-06-20 15:48:14 -07:00