Commit Graph

57490 Commits

Author SHA1 Message Date
Alex Vandiver 57ff573535 topic: Move sqlalchemy methods into their own file.
Loading sqlalchemy can take a significant amount of time, so splitting
these into these own file can be a significant startup-time savings.
2024-04-16 09:48:11 -07:00
Shubham Padia 1abd356a91 custom_profile_fields: Make required field optional during update. 2024-04-15 16:52:11 -07:00
Shubham Padia 8c30b61201 custom_profile_fields: Display_in_profile_summary optional for update. 2024-04-15 16:35:42 -07:00
Shubham Padia 137776b092 custom_profile_fields: Make field_data optional during update. 2024-04-15 16:35:42 -07:00
Shubham Padia c6c392bcc7 custom_profile_fields: Make name & hint optional during update.
Fixes #23022.
Added a new validation function that validates updates to custom
profile fields.
2024-04-15 16:35:39 -07:00
Mateusz Mandera 4a2a9176c2 realms: Add caching to the get_seat_count calculation for upload limit.
For simiplicty's sake, we can avoid trying to do cache invalidation in
the variety of events that can cause the seat count to change - since
having an up to 1 day delay between users being added and the upload
limit going up is quite reasonable.
2024-04-15 15:08:56 -07:00
Mateusz Mandera 066de96a86 uploads: Implement 5GB/user quota for paid orgs on Zulip Cloud.
Fixes #28621

Till now, this was actually a flat 50GB despite what the /plans/ page
says and was adjusted flexibly when somebody asked for a higher limit.

This actually implements the advertised formula, but changing it to
5GB/user since that's a more reasonable limit.

Keeps the 50GB limit for sponsored Standard Free organizations and also
places it as the floor for the quota for paid orgs, to not lower this
for tiny orgs with less than 5 users.
2024-04-15 15:08:56 -07:00
Mateusz Mandera 4eacd25ad5 stripe: Rename CustomerPlan.is_paid.
This might not be the most meaningful change of phrasing, but .is_paid()
sounds like it's a check for whether the customer has already paid their
invoice. is_a_paid_plan() reflects better the meaning that it's whether
it's a plan of a "paid" type.
2024-04-15 15:08:56 -07:00
Mateusz Mandera 8038e2322c realm: Change implementation approach for upload_quota_gb.
Most importantly, fixes a bug where a realm with a custom
.upload_quota_gb value (set by changing it in the database via e.g.
manage.py shell) would end up having it lowered while upgrading their
plan via the do_change_realm_plan_type function, which used to just set
it to the value implied by the new plan without caring about whether
that isn't lower than the original limit.

The new approach is cleaner since we don't do db queries by
upload_quota_gb so it's nicer to just generate these dynamically, making
changes to our limit-per-plan rules much easier - skipping the need for
migrations.
2024-04-15 15:08:56 -07:00
Mateusz Mandera 540d419ef7 events: Fix realm_upload_quota_mib value to be in MiB.
This was bytes until now.
2024-04-15 15:08:56 -07:00
Tim Abbott 3df46d542b Revert "message_reactions: Clean meassge reactions during initial processing."
This reverts commit c22a94dc89.

This broke live-update when adding new reactions.
2024-04-15 14:58:06 -07:00
Alex Vandiver b0e3191434 puppet: Stop relying on "tidy" ordering, which ignores metaparams.
The `tidy` parameter is buggy, and ignores all ordering
metaparameters.  This is fixed in Puppet 7[^1], but it's helpful to
resolve it now.  Specifically, this fixes bugs with tidy running too
early, and deleting the old version of a package before its new
version is installed or symlinked, leaving a race condition if
anything tries to run the binary in this window.

This is mostly not a problem for Supervisor-managed processes, since
the binary is already running, and can continue to run if it is tidied
out from under the running process.  For stand-alone tools like wal-g,
which are run frequently by PostgreSQL, this may cause issues if
PostgreSQL tries to call them during a puppet run.

Remove all complicated uses of tidy, and replace them with an `exec`
which does the equivalent.  We also generate `file` resources for
binaries, making them easier (and clearer) to specify as dependencies.

[^1]: https://puppet.atlassian.net/browse/PUP-10688
2024-04-15 14:30:24 -07:00
Alex Vandiver d341e6ced1 runtornado: Honor the --skip-checks flag.
This is particularly important because they can be quite heavy-weight.
2024-04-15 14:29:27 -07:00
Alex Vandiver 043d3127eb upload: Only load S3 backend (and thus boto3) if necessary.
Because loading boto3 is so slow, this saves a significant amount of
time (0.3s or so) in process startup on servers which are not using
the S3 file storage backend.
2024-04-15 13:12:51 -07:00
Mateusz Mandera bd00337776 docs: Document new create_guests_without_streams SCIM option.
Documents the little functionality added in
c9ca4e68e5.
2024-04-15 11:16:59 -07:00
Lauryn Menard 4e5c62527c activity: Update installation total row for moving referrer column.
Updates the total row so that the ARR and user counts align with
the column updates in commit 971123565f.
2024-04-15 10:52:41 -07:00
Lauryn Menard 0452751e9e api-docs: Bump API version for addition of channel/channels operators.
In commit 32d5b4fe3e, the channel and channels operators were
documented in the API docs. This bumps the API version to match
those changes.

Also, cleans up one Changes note from the same commit noted above.
2024-04-15 10:51:48 -07:00
N-Shar-ma 352e2ebc5a todo_widget: Move the `add-task-bar` from above to below the task list.
When users needed to add a new task in the todo widget, they would type
it in the field at the top, but the task would be appended to the list,
showing up at the very bottom, which can seem unintuitive.

Now the `add-task-bar` is at the bottom of the list, so that when a new
task is added, it'll appear right where it was typed. The task field
would then shift lower.
2024-04-13 21:56:33 -07:00
N-Shar-ma d8a8364d1a todo_widget: Allow tasks to be added through `/todo` command.
Uptil now, users could add tasks to a todo widget only after creating
it through the `/todo` command in the compose box.

Users can now add an initial list of tasks using the `/todo` command,
with each task on a new line in the compose box, where the 1st `:`
would separate a task from its (optional) description. Example:
`/todo\nTask1:description1\nTask2 without description`.

Fixes part of #20213.
2024-04-13 21:56:33 -07:00
N-Shar-ma 6df3ad251a todo_widget: Allow task list title to be set and edited by author.
Users can now name task lists by providing the task list title in the
`/todo` command on the same line. Example: `/todo School Work`. If no
title is provided by the user, "Task list" (which is also the
placeholder) is used as default.

The author of a task list can later edit / update the task list title
in the todo widget, just like the question in the poll widget.

Fixes part of #20213.
2024-04-13 21:56:33 -07:00
N-Shar-ma b30eb4c4fc widget: Fix bug where 2nd line became poll question.
Uptil now, if the user did not specify a poll question, but included
options when using the `/poll` command, the 1st option wrongly
became the poll question.

Now on leaving the poll question space blank, the next line will not be
confused for it, and the poll widget will have an input for adding a
question.
2024-04-13 21:56:33 -07:00
N-Shar-ma 8c000f348a widgets: Make Zod schema for widget extra data stricter and extendable.
The schema now ensures extra data is validated according to the widget
type. This also makes it easier to modify the extra data for any widget
or add new widget types in the future.
2024-04-13 21:56:33 -07:00
Alex Vandiver 5990835bc1 realm_export: Use .count(), instead of len(). 2024-04-13 21:50:42 -07:00
Olivier FAURE 29e32c3977
keyboard ui: Add early-exit to click handlers with shift.
Shift-clicking a link on most browsers should open the link in a new window, 
not navigate inside the current tab, just like ctrl-click opens in a new tab.
2024-04-13 21:48:03 -07:00
Varun Singh ee232bba05 settings_linkifiers: Convert module to TypeScript. 2024-04-13 21:45:44 -07:00
Varun Singh bc530162ca state_data: Add 'realm_linkifiers' to type. 2024-04-13 21:45:44 -07:00
Aman Agrawal 971123565f activity: Rearrange columns. 2024-04-13 21:41:12 -07:00
Aman Agrawal 42c5a04804 hello: Apply same link styles to all the screen descriptions. 2024-04-13 21:32:50 -07:00
N-Shar-ma e7a19aca75 emoji_picker: Search result emojis now named as the matching alias.
This fixes the bug where on hovering / selecting an emoji picker search
results emoji, invariably its canonical name would show / be used, which
is not always the same as the matching alias. For example, searching for
"swe" would show the "sweeping" emoji, but its canonical name is "broom"
which can be a confusing search result for "swe".
2024-04-12 17:40:24 -07:00
Karl Stolley e43384bd90 markdown: Modernize presentation of spoiler headers. 2024-04-12 17:39:36 -07:00
Karl Stolley f2a1c96940 spoilers: Adjust HTML source order to match presentation. 2024-04-12 17:39:36 -07:00
Alex Vandiver a49111c89a invites: Use query.count() not len(query). 2024-04-12 17:37:11 -07:00
Alex Vandiver f7bc881ca3 puppet: Update dependencies. 2024-04-12 15:06:42 -07:00
Alya Abbott dc699668dd portico: Update text on home page. 2024-04-12 15:01:38 -07:00
Alex Vandiver 8d3120bf17 kandra: Remove zulip::static_asset_compiler include.
This was removed in 263212decf.
2024-04-12 15:00:33 -07:00
Lauryn Menard 32d5b4fe3e api-docs: Document the "channel" and "channels" search/narrow operators.
Documents the addition of "channel" and "channels" as operators for
search/narrow filters, noting that they are aliases of the "stream"
and "streams" operators.

This change does not yet deprecate the "stream" and "streams"
operators.

Part of stream to channel rename project.
2024-04-12 13:44:25 -07:00
Lauryn Menard a446033f32 filter: Use "channels" operator for the Filter class.
Update the Filter class to use "channels" as the canoncial operator
for public stream searches and web-public message fetch narrows,
but keep using "streams" for user-facing text and URLs.

When searching, "channels" does not create any suggestions until
a colon is added and then it shows suggestions with "streams". And
when a search string with channel as an operator is entered, then
it is replaced by "streams" as well.

Part of stream to channel rename project.
2024-04-12 13:44:25 -07:00
Lauryn Menard 1e7c5b38f8 filter: Use "channel" operator for the Filter class.
Update the Filter class to use "channel" as the canoncial operator
for streams, but keep using "stream" for user-facing text and URLs.

When searching, "channel" does not create any suggestions until
a colon is added and then it shows suggestions with "stream". And
when a search string with channel as an operator is entered, then
it is replaced by "stream" as well.

Part of stream to channel rename project.
2024-04-12 13:44:25 -07:00
Lauryn Menard e3a521f4ba filter: Use canonical terms when updating Filter for message moves.
Updates filter_with_new_params so that the terms used to update the
current narrow filter are the canonical version of the terms. This
assures that the adjustments we're making are correct.
2024-04-12 13:44:25 -07:00
Lauryn Menard 7761675497 tests: Update filter.test.js to use constants for message type.
Updates filter.test.js to use constants when checking the message
type ("stream" or "private") as this eliminates overlap with the
search/narrow operator "stream" and is useful prep for eventually
updating the frontend code to use "direct" as the message type
for direct mesages.

Part of stream to channel rename project.
2024-04-12 13:44:25 -07:00
Lauryn Menard 608b30577a narrow: Add backend support for "channels" operator.
Adds backend support for "channels" operator.

This will deprecate/replace the "streams" operator eventually, but
we will keep support of the operator for backwards compatibility
for a while.

Part of renaming stream to channel project.
2024-04-12 13:44:25 -07:00
Lauryn Menard 0e972e26da narrow: Add backend support for "channel" operator.
Adds backend support for "channel" operator.

This will deprecate/replace the "stream" operator eventually, but
we will keep support of the operator for backwards compatibility
for a while.

Part of renaming stream to channel project.
2024-04-12 13:44:25 -07:00
Lauryn Menard 692d5e9706 narrow: Update check to prevent conflicting dm and channel narrow.
Prep commit for deprecating the "stream" search operator and
replacing it with the "channel" operator, and for depreacting the
"streams" operator and replacing it with the "channels" operator.
2024-04-12 13:44:25 -07:00
Lauryn Menard 94ac3f2b58 test-message-fetch: Replace stream with channel for variables/names.
Prep commit for deprecating the "stream" search operator and
replacing it with the "channel" operator, and for depreacting the
"streams" operator and replacing it with the "channels" operator.

Replaces test names, variables and strings to use channel instead
of stream, so that subsequent commits that change the code
are clearer.
2024-04-12 13:44:25 -07:00
PieterCK 9b107e3ce1 integrations: Fix styling of unordered lists inside ordered lists.
This change allows different types of lists to
be rendered properly inside the {{start_tabs}} /
{{end_tabs}} block in markdown.

Fixes zulip#29669

Suggested-by: Lauryn Menard <github:laurynmm>
2024-04-12 13:30:33 -07:00
joaoafonso07 5eff81407c
invite: Fix scrolling to invitation success/error messages.
Change the way scrolling was implemented by scrolling to the success
message. Done this by calling the scrollIntoView() method with the
success message id, it scrolls the element with id into the visible
area of the browser window.
This way the confirmation banner becomes visible, scrolling the
invitation modal to the top when a user sends invites or generates an
invite link.
Previously, it did not scroll, as we were passing the id of the whole
dialog element to the get_scroll_element function.

Fixes #28906.
2024-04-12 13:06:22 -07:00
Kenneth Rodrigues c22a94dc89 message_reactions: Clean meassge reactions during initial processing.
Clean reactions and set message_reactions in process_new_message.
Earlier, message_reactions was being set
after the predicate for the narrow was built,
as a result functions called while building the predicate
could not access it.
2024-04-12 12:42:54 -07:00
Kenneth Rodrigues c3408b56f0 search: Add server support for has:reaction search operator.
Web app support will be a follow-up commit.
2024-04-12 11:57:57 -07:00
Alex Vandiver 436dab0e01 messages: Remove use of @overload in access_message.
f92d43c690 added uses of `@overload` to probide multiple type
signatures for `access_message`, based on the `get_user_message`
parameter.  Unfortunately, mypy does not check the function body
against overload signatures, so it allows type errors to go
undetected.

Replace the overloads with two functions, for one of which also
returns the usermessage.  The third form, of only returning if the
usermessage exists, is not in a high-enough performance endpoint that
a third form is worth maintaining; it uses the usermessage form.
2024-04-12 11:41:27 -07:00
Alex Vandiver 30f71639f0 pg_backup_and_purge: Properly preserve needed base backups.
Without `FIND_FULL`, `wal_g delete before ...` will fail, rather than
delete a base backup which is needed by the delta backups after it.
By passing `FIND_FULL`[^1], we tell it explicitly that we're OK
preserving files before the specified one, as long as they are
necessary for the delta chain.

[^1]: https://github.com/wal-g/wal-g/blob/master/docs/README.md#delete
2024-04-12 11:39:54 -07:00