Commit Graph

60706 Commits

Author SHA1 Message Date
Lauryn Menard 4bd4534450 billing: Enforce manual license management for guest role changes.
Adds a check for changing an existing guest user's role before
calling do_update_user in the case that a realm has a current
paid plan with manual license management.
2024-09-20 12:02:39 -07:00
Lauryn Menard 7861c1ba63 billing: Enforce manual billing renewal licenses for new users.
In addition to checking for available licenses in the current
billing period when adding or inviting new non-guest users, for
manual billing, we also verify that the number of licenses set
for the next billing period will be enough when adding/inviting
new users.

Realms that are exempt from license number checks do not have
this restriction applied.

Admins are notified via group direct message when a user fails
to register due to this restriction.
2024-09-20 12:02:39 -07:00
Lauryn Menard 73cb08265c billing: Extract helper for getting manual license management plans.
Prep commit for expanding these checks for the number of licenses
set for the next billing period (renewal licenses) and for changing
guest users' roles.
2024-09-20 12:02:39 -07:00
Lauryn Menard 137f4fccde billing: Highlight manual license management errors for admins.
In the billing portal UI for manual license management, limit
decreasing the number of licenses for the next billing period to
be less than the currently used licenses. If the customer is exempt
from license number checks, then this limit is not applied.

Also, visually highlight manual license management errors so that
the billing admin is aware of potential issues.

As of these changes, current licenses can be under the seat count
when a guest user is changed to a non-guest user. And next billing
period licenses can be under the seat cout when a user joins with a
currently available, purchased license after a billing admin has
decreased the number of licenses set for the next billing period.
2024-09-20 12:02:39 -07:00
Lauryn Menard b02cf53d5e billing: Validate license management at end of billing cycle.
For plans where we're enforcing correct manual license management,
before we create the renewal entry for the licenses ledger at the
end of a billing cycle, we should check that the current count of
billed licenses is not higher than what the renewal license count
would be.

Co-authored-by: Aman Agrawal <amanagr@zulip.com>
2024-09-20 12:02:39 -07:00
Lauryn Menard 900a7fa3ac billing: Remove settings tab from billing urls.
In commit 89003dcb25, we removed the tabs from the billing page.
2024-09-20 12:02:39 -07:00
Aman Agrawal ea4e48afa7 filter: Add function to check if we can show the next unread button.
These function will be used when we add `Next unread conversation`
button below message list.
2024-09-20 11:54:18 -07:00
Aman Agrawal 0fb63eeddf filter: Rename local variable.
`term_types` is consistently used to store return value of
sorted_term_types in the file.
2024-09-20 11:54:18 -07:00
Aman Agrawal 56d4bad92b filter: Fix filter variable not updated as per new terms. 2024-09-20 11:54:18 -07:00
Karl Stolley 3d875bd140 integration_events: Restore checkbox in events modal. 2024-09-20 11:53:01 -07:00
Aman Agrawal a35c8a08de message_edit: Attach keydown to $form instead of textarea.
This allows any event handlers that are attached to textarea
like typeahead to handle the keypress and stop propagation if
they successfully handle it.

This fixes a bug where message edit form gets saved on enter keypress
instead of selecting the active item in the message edit typeahead.

Introduced in 0696e234bd.
2024-09-20 09:50:38 -07:00
Mateusz Mandera 18fbb5d146 retention: Limit number of ids passed to db in delete messages query.
If do_delete_messages (and friends) are called for a massive number of
messages, the giant list of message ids is passed to Postgres even
though chunk_size makes all but the first chunk_size of message ids
useless.
2024-09-20 09:31:21 -07:00
Mateusz Mandera ed7c330548 retention: Rename run_archiving_in_chunks to run_archiving. 2024-09-20 09:31:21 -07:00
Prakhar Pratyush 86194efe7b realm_export: Add a new endpoint to fetch private data export consents.
This commit adds a new endpoint `export/realm/consents` to
fetch the consents of users for their private data exports.

Fixes part of #31201.
2024-09-20 09:10:32 -07:00
Inge ffbf2aaaff right-sidebar: Others collapsed by default
"Others" will on default be collapsed. If it is expanded it will be preserved when switching view.

Fixes #31628
2024-09-20 09:09:03 -07:00
Alex Vandiver e43eaaebf0 openapi: Update upload-file example response to add filename. 2024-09-20 09:07:21 -07:00
Sayam Samal 19c29af4bb icons: Cleanup redundant `.fa-group` related styling.
This also fixes the opacity of the `.zulip-icon-triple-users` icon in
the recent view.
2024-09-20 09:07:05 -07:00
Sayam Samal 030f93595e icons: Replace previous bot icon with new single antenna bot icon.
Co-authored-by: Alex Vandiver <alexmv@zulip.com>
2024-09-20 09:07:05 -07:00
Alex Vandiver 88acfbca8c docs: Adjust for 100MB MAX_FILE_UPLOAD_SIZE. 2024-09-20 09:05:11 -07:00
evykassirer 3e2efc736c stream_data: Add test cases for getting stream id from slug. 2024-09-19 19:52:18 -07:00
evykassirer 50b43421f1 search: Hide outline unless focus-visible.
Followup to https://github.com/zulip/zulip/pull/31647#discussion_r1767352535
2024-09-19 19:51:43 -07:00
Karl Stolley d73044ee57 compose: Decouple compose buttons from button classes.
In the 2024 redesigned button configurations, the compose buttons
become outliers. This retains their previous style inherited from
.button, allowing that base component class to move forward.
2024-09-19 16:16:11 -07:00
evykassirer 5ddcbb8516 buddy_list: Show offline subscribed users for small channels in big orgs.
Previously, for big orgs, we hid all offline users in the buddy list to cut down
its size. But this can be weird for small channels where you might want to see
who's in the channel. This commit makes a tweak to show offline users in big
orgs for channels of size <= 50.
2024-09-19 15:43:28 -07:00
Tim Abbott 9dd8de64a9 message_list: Add should_trigger_message_selected_event to type. 2024-09-19 15:43:28 -07:00
evykassirer deb5d90941 message_list: Convert module to typescript. 2024-09-19 15:31:16 -07:00
evykassirer 620db3057b message_list: Fix bug accessing filter incorrectly.
I checked this with Aman who wrote this originally, and he said
this is what he meant to write.
2024-09-19 15:31:16 -07:00
evykassirer c9f49cefdd message_list: Remove unused preserve_rendered_state attribute.
Aman said  we should be running this even if it wasn’t running before.
https://github.com/zulip/zulip/pull/31591#pullrequestreview-2300886181
2024-09-19 15:31:16 -07:00
Mateusz Mandera 1d7d3fae61 signup: Mirror dummy user should be registered with role from invite.
Aside of what's generally explained in the code comment, this is
motivated by the specific situation of import of Slack Connect channels.
These channels contain users who are "external collaborators" and
limited to a single channel in Slack. We don't have more sophisticated
handling of their import, which would map this concept 1-to-1 in Zulip -
but we create them as inactive dummy users, meaning they have to go
through signup before their account is usable.

The issue is that their imported UserProfile.role is set to Member and
when they register, the UserProfile gets reactivated with that role
unchanged. However, if e.g. the user is signing up after they received
an invitation from the admin, they should get the role that was
configured on the invite. In particular important if the user is meant
to still be "limited" and thus the admin invites them as a guest - they
definitely don't want the user to get a full Member account because of
this weird interaction between import and registration.
2024-09-19 15:26:27 -07:00
Aman Agrawal fd441fd3d3 hashchange: Extract function to get home view hash. 2024-09-19 13:50:47 -07:00
Aman Agrawal 02f84bda34 message_list: Avoid recursive calls to message_selected event.
Note that even though we no longer trigger message selection
events from within the rerender calls with their different `opts`,
it doesn't effect the scroll position and selected id since
the events are triggered synchronously and the final message
selection event call has the opts of the initial caller.
2024-09-19 13:20:49 -07:00
Alex Vandiver 24d110f063 settings: Increase default max file upload size to 100MB.
This also _lowers_ the default nginx client_max_body_size, since that
no longer caps the upload file size.
2024-09-19 11:37:29 -07:00
Alex Vandiver 94dad72b75 upload: Use @uppy/tus to upload files through tusd.
Replace the XHRUpload plugin for Uppy with the Tus plugin, to make use
of the new tusd endpoint.  This allows for resumable files, as well as
files which are larger than comfortably fit in memory (the source of
the old 25MB limit).

MAX_FILE_UPLOAD_SIZE is still applied, but can safely be raised above
25MB.

Fixes: #9391.

Co-authored-by: Brijmohan Siyag <brijsiyag@gmail.com>
2024-09-19 11:37:29 -07:00
Alex Vandiver 818c30372f upload: Use tusd for resumable, larger uploads.
Currently, it handles two hook types: 'pre-create' (to verify that the
user is authenticated and the file size is within the limit) and
'pre-finish' (which creates an attachment row).

No secret is shared between Django and tusd for authentication of the
hooks endpoints, because none is necessary -- tusd forwards the
end-user's credentials, and the hook checks them like it would any
end-user request.  An end-user gaining access to the endpoint would be
able to do no more harm than via tusd or the normal file upload API.

Regardless, the previous commit has restricted access to the endpoint
at the nginx layer.

Co-authored-by: Brijmohan Siyag <brijsiyag@gmail.com>
2024-09-19 11:37:29 -07:00
Alex Vandiver 02d3fb7666 nginx: Allow HTTP access to internal endpoints from localhost. 2024-09-19 11:37:29 -07:00
Aman Agrawal 9a1ad1047a test_stripe: Normalize stripe fixtures.
Normalize generated fixtures for exp_month, exp_year and postal code.
2024-09-19 11:26:21 -07:00
Aman Agrawal 4d8e6ba094 stripe: Change stripe email on the upgrade page if available. 2024-09-19 11:26:21 -07:00
Aman Agrawal 9a4a07d933 stripe: Allow user to update email for sending invoice. 2024-09-19 11:26:21 -07:00
Aman Agrawal 6f094f0350 test_backend: For serial mode for stripe fixture generation.
It is important for stripe fixtures to be generated in serial
mode so that customer and event data doesn't overflow between
tests.
2024-09-19 11:26:21 -07:00
evykassirer 56adeb335f search: Fix cutoff focus outline. 2024-09-19 10:50:21 -07:00
Sahil Batra 1f16c0fdb7 popovers: Increase contrast of deactivated information text.
This commit increases the contrast for "This user has been deactivated"
text in user popover and "This group has been deactivated" text in
group popover in both light and dark mode by making the opacity 1 as
this is important information and should be clearly visible.

The text color and opacity matches with the role text shown in user
popover.
2024-09-19 10:50:02 -07:00
Sayam Samal 4ed27a9a5f tooltips: Fix hotkey hints wrapping when next to longer tooltip labels.
Earlier, mostly in non-English languages, the tooltip labels would
force the tooltip hotkey hints to wrap. This commit adds the
`white-space: nowrap` property to ensure that the hotkey hint texts
are forced to be in a single line.
2024-09-19 10:49:15 -07:00
evykassirer 86564381cf message_view_header: Rename current_stream to more accurate current_sub. 2024-09-19 10:06:57 -07:00
Sahil Batra 63a7c9061b settings: Use new pills UI for can_manage_group setting.
This UI enables the user to set can_manage_group setting to a
combination of users and groups, replacing the old dropdown UI
which just allowed setting user to a single system group.

Fixes part of #28808.
2024-09-19 09:08:33 -07:00
Sahil Batra 8068b6e55e group_setting_pill: Add code for showing typeahead.
This commit adds code to show typeahead for group setting
pill container. We add a separate function as we only
want to show groups and users in the typeahead and the
options are also sorted in a different order compared
to other typeaheads.
2024-09-19 09:08:33 -07:00
Sahil Batra 053686669a composebox_typeahead: Use query_matches_group_name to match group.
Though we can use query_matches_name for groups as we do not allow
system groups in the composebox typeahead and the other groups have
same display_name and name values, but still would be better for
consistency.

And with this change, query_matches_name function is only used for
streams, so updated that accordingly.
2024-09-19 09:08:33 -07:00
Sahil Batra def78ddf09 user_groups: Do not show "role:" prefix for system groups.
Instead of showing the actual names like "role:everyone",
"role:moderators", etc. for system groups, we show
"Everyone", "Moderators", etc. for system user group in
pills, typeaheads and popovers.

Though system groups are not shown in typeahead as of
this commit, we update the typeahead code as well to
not conside "role:" prefix while matching with the
query as we would soon show system groups in typeahead
when we would add new UI for group-based settings.

Previously, only "role:everyone" group was shown as
"Everyone" in popover and pills but for other system
groups their original names for shown and this commit
changes that behavior to be same for all system groups.

The original display_name field for
settings_config.system_user_groups_list objects, which
was used for dropdown widgets, is also renamed so that
we can use display_name field for the names to be used
in other places.
2024-09-19 09:08:33 -07:00
Sahil Batra 2fff124ec9 settings: Add new module to handle pills for group settings.
This commit creates a new module similar to add_subscribers_pill
for handling the pill widget to be used for group settings.
2024-09-19 09:08:33 -07:00
Alya Abbott acd578c769 help: Replace instructions to delete a group with deactivation. 2024-09-18 15:36:12 -07:00
Anders Kaseorg 2c8ad219b1 styles: Fix invalid CSS generated due to @extend misusage.
@extend can only be used in an element selector, not directly within
@media.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-09-18 15:33:28 -07:00
Anders Kaseorg dc6ba1c9e2 localstorage: Remove unused expiry feature.
This was introduced by commit 8b22b94ab1
with no actual cleanup mechanism, and has never been used.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-09-18 15:32:07 -07:00