Commit Graph

63435 Commits

Author SHA1 Message Date
Shubham Padia
a8dd4d8fb9 streams: Add the ability to modify can_add_subcribers_group.
We are just adding the ability to change the value of this setting in
this commit. It is not used for all possible permission checks on the
frontend yet. That will be done in future commits.
2025-01-22 14:27:06 -08:00
Shubham Padia
41c74314c0 streams: Use can_add_subscribers_group for permission check.
The function to check relevant permissions does so for multiple streams
at once to save us database query counts. Doing it one by one for every
stream would become very expensive.
We've also added `insufficient_permission_streams` to the filter
functions return type for streams for which the current user does not
have permission to subscribe other users.
2025-01-22 14:27:06 -08:00
Shubham Padia
7df417f8b1 invite: Extract common logic into it's own function.
The logic to get streams and user groups was common between a normal
invite and a multiuse invite.
2025-01-22 14:27:06 -08:00
Shubham Padia
97996b9929 streams: Add can_add_subscribers_group as a setting.
We're not using this setting to check the permissions yet.
2025-01-22 14:27:06 -08:00
Tim Abbott
b1a5755864 openapi: Fix broken links to group-setting-values. 2025-01-22 14:27:06 -08:00
Tim Abbott
84be984619 docs: Add documentation on using icons. 2025-01-22 12:54:19 -08:00
Alya Abbott
d4426f3bab contributor docs: Document how to add and modify icons. 2025-01-22 12:54:19 -08:00
Shubham Padia
24341076a3 realm: Delete invite_to_stream_policy. 2025-01-22 12:33:58 -08:00
Shubham Padia
275a1a4c69 realm: Use can_add_subscribers_group instead of invite_to_stream_policy.
We remove `invite_to_stream_policy` from the backend wherever applicable
except deleting the field. We have just ported the existing behaviour of
`invite_to_stream_policy` to `can_add_subscribers_group` except one
change. We have added an explicit exception for admins to have this
permission whether they are part of this group or not. The reason for
this is we are adding `stream.can_add_susbcribers_group` in the future
which will grant all admins permission to subscribe other users to a
channel given they have access to a channel. So it makes sense that we
add this exception to the realm level property also.
See https://chat.zulip.org/#narrow/channel/101-design/topic/Can.20subscribe.20other.20users.20on.20user.20profile/near/2039825
2025-01-22 12:33:58 -08:00
Shubham Padia
9402b248a1 state_data: Remove can_subscribe_other_users attribute.
While `can_subscribe_other_users` property will make sense for the
current permissions structure where the ability to add subscribers to
channels is dictated with a realm level setting. In the future, we are
adding a channel level `can_add_subscribers_group`, and having a
property called `can_subscribe_other_users` in state_data will be
confusing since the permission to add subscribers will vary channel to
channel.
We have not removed user.can_subscribe_other_users, that will be better
removed when we add the channel level setting.
See more discussion at
https://chat.zulip.org/#narrow/channel/378-api-design/topic/invite_to_stream_policy.20deprecation/near/2039787
2025-01-22 12:33:58 -08:00
Shubham Padia
3bf87228a2 settings: Use can_add_subscribers_group instead of realm policy.
We are using `can_add_subscribers_group` instead of
`invite_to_stream_policy` to check whether a user can subscribe other
users.
We've removed `invite_to_stream_policy` from the frontend wherever
applicable.
2025-01-22 12:33:58 -08:00
Shubham Padia
34ade0d9a2 realm: Add ability to set can_add_subscribers_group in frontend.
The setting is not used anywhere yet either on the frontend or the
backend, we are just adding the ability to change the value of the realm
setting. We have also removed the ability to set
`invite_to_stream_policy` in this commit while it continues being used
to check permissions.
We have changed the label of the setting from `Who can add users to
channels` to `Who can subcribe users to channels` and label_parens_text
as `in addition to organization administrators` as discussed in
https://chat.zulip.org/#narrow/channel/101-design/topic/Can.20subscribe.20other.20users.20on.20user.20profile/near/2039825
2025-01-22 12:33:58 -08:00
Shubham Padia
3cdc9d8459 realm: Add can_add_subscribers_group as a setting.
This commit just adds the setting, the work to use this setting and
replace `invite_to_stream_policy` will be done in future commits.
2025-01-22 12:33:56 -08:00
Alex Vandiver
3ec896ebda nginx: Add an option which defaults loadbalancer requests to https.
In some cases, it is not possible to configure the load-balancer to
add an X-Forwarded-Proto header.  If Zulip is serving its traffic over
HTTP, it will rightly error out, since it cannot guarantee that its
response will be served over an encrypted connection.

Add a new `loadbalancer.rejects_http_requests` settings which serves
as a way for the operator to swear that the load-balancer will *never*
serve responses from Zulip over an unencrypted connection.  In most
cases, this is because the load-balancer is configured to have port 80
always serve an HTTP 301 redirect to the same URL over HTTPS.

Properly configuring the proxy to send `X-Forwarded-Proto` is always a
better solution than using this configuration parameter, so use of
this should be viewed as a last resort.
2025-01-22 12:25:42 -08:00
Aman Agrawal
b047c4d322 message_summary: Add API endpoint to generate narrow summary.
This prototype API is disabled in production through settings not
configuring a default model.
2025-01-22 12:12:08 -08:00
Sourabh Patel
6a5c33788d color_picker: Enable vertical keyboard navigation at channel settings.
At Channel settings overlay, vertical keyboard navigation
on color picker was obstructed by stream_settings_ui.switch_rows.
This commit fixes the issue by using
`color_picker_popover.handle_keyboard` prior to
`stream_settings_ui.switch_rows`
2025-01-22 10:56:28 -08:00
Steve Howell
c66d790fac server tests: Avoid assertCountEqual in easy places. 2025-01-22 10:55:25 -08:00
Steve Howell
6fcbd2f2d2 test helpers: Simplify check_user_subscribed_only_to_streams.
b4fedaa765 introduced
this helper, and I assume that the weird loop over
zip made sense at the time.

The assertEqual approach on the whole
set gives nice messages in modern Python.
2025-01-22 10:55:25 -08:00
Steve Howell
deb53070ae default streams: Return set instead of a list.
We also change the test helper.

The tests hopefully read more clearly in places
here, and we also communicate to the dev that
order is arbitrary.
2025-01-22 10:55:25 -08:00
Sourabh Patel
25a7d6b9ca move_topic_modal: Move .topic_move_breadcrumb_messages to popovers.css. 2025-01-22 09:31:43 -08:00
Sourabh Patel
03111ddb26 move_topic_modal: Remove nowrap to allow text wrapping.
Avoids overflow when screen_width<390px.
2025-01-22 09:31:43 -08:00
Sourabh Patel
ff031abf1e move_topic_modal: Fix dropdown shrinking too much for smaller screens.
On smaller screens it is expected that the available space is used
to display much part of the content. 100% width ensures that while
max-width ensures that the dropdown button doesn't become too wide
where there's extra space available.
2025-01-22 09:31:43 -08:00
Sourabh Patel
5fc7684beb move_topic_modal: Remove flex properties that caused overflow.
Using flex here caused overflow which was especially visible for
very long channel names(~60 characters). Even for the shorter
channel names there was slight overflow noticeable in input class
move_messages_edit_topic if left and right spacing was compared.

This commit fixes the issue by removing the flex display.
2025-01-22 09:31:43 -08:00
whilstsomebody
14d96bf932 user_profile: Fix incorrect rendering of groups and channels list.
It was found that adding or removing an item from a group
or channel list updated the list correctly initially.
However, when revisiting the group or channel list tab, the
removed item was still present. The item was only removed
after closing and reopening the user profile menu popover.

This commit fixes the bug by correctly fetching the data
and live-updating the list.
Also, we used to re-render the groups and channels list
everytime we opened the groups or channels tab. Now, we
render the list only once when the corresponding tab is
opened for the first time.

Fixes: #33071
2025-01-22 09:29:32 -08:00
Aman Agrawal
b549562a4d sponsorship: Ask user how they plan to use Zulip.
This will help avoid some back-and-forth on sponsorship requests.
2025-01-22 09:22:52 -08:00
ritwik-69
dd56e04dc6 presence: Record stats for invisible users. 2025-01-22 09:19:15 -08:00
Steve Howell
d00934b0ef bug fix: Check offsets when browser doesn't canonicalize.
This is more of a workaround than a bug fix.

Some JS implementations are less "aggressive" about
canonicalizing things like America/Montreal to America/Toronto.

We instead use offset checks.
2025-01-22 09:16:50 -08:00
Steve Howell
8227070087 timerender tests: Kill off tests for canonicalizing.
These tests are false positives in some cases, since
browser behavior varies.

We will kill off the function soon, but for now we
still maintain 100% coverage (albeit indirectly).

I also split up a test into two smaller ones.
2025-01-22 09:16:50 -08:00
Steve Howell
fe39f94e52 timezone server tests: Verify Montreal -> Toronto.
This new test verifies that the server will
canonicalize the America/Montreal timezone to
America/Toronto. In general, we canonicalize via
the standard Python libraries for cities that
are aliases.
2025-01-22 09:16:50 -08:00
Sahil Batra
92376fc133 message_edit: Rename get_message_edit_request_object.
"build_message_edit_request" is a better name for the function.
2025-01-22 09:11:47 -08:00
Steve Howell
650130837a markdown tests: Reveal O(N) behavior to get groups.
This is essentially a failing test that we can improve
by addressing #32934. It is also a useful test to measure
the actual impact of any improvements (with some more
instrumentation).
2025-01-22 09:11:32 -08:00
Steve Howell
14ca1bf2ae markdown tests: Check actual value of set.
The use of assertCountEqual preceded
my changes to use a set instead of a list.

Now assertEqual is more clear and concise.

I should have noticed this in 36a6f0c547
but I caught it now.
2025-01-22 09:11:32 -08:00
Shubham Padia
75b6b1d54f polls: Do not use pixel height for poll title.
Poll title was set to 18px which was leading to the title looking
smaller than the options in 20px font size. Removing that explicit
font-size declaration will make the h4 font-size fall back to 1.1em and
thus that title will scale properly to font-size changes. At 16px, the
font-size for the title was 18px initially, now it is 17.6px which
should not be that big of a change.
2025-01-21 16:22:53 -08:00
Aman Agrawal
6e1bb56519 stripe: Check for min_licenses when switching plan tier.
When we are upgrading a customer to a different plan tier, we should
check if switching plans would lead to different licenses due to
different minimum license requirement between plans.
2025-01-21 15:53:53 -08:00
Lauryn Menard
10b2e2a092 support: Update support view PlanData to use "complimentary access".
Prep for implementing a complimentary access plan for Zulip Cloud.
2025-01-21 15:40:27 -08:00
Lauryn Menard
1297541059 stripe-tests: Update uses of "legacy" to "complimentary access". 2025-01-21 15:40:27 -08:00
Lauryn Menard
8d638363da corporate: Update self-hosted complimentary access plan name.
Updates the name for the self-hosted complimentary access plan
to "Zulip Basic (complimentary)" instead of "Free (legacy plan)".

Since these plans are never billed in Stripe, we don't need to
hold to the 22 character limit for the plan name.
2025-01-21 15:40:27 -08:00
Lauryn Menard
261333c37f corporate: Clean up code remaining comments with "legacy plan".
Replaces documentation in billing code and tests to use
"complimentary access plan" instead of "legacy plan".
2025-01-21 15:40:27 -08:00
Lauryn Menard
bc20a0f086 support: Update "temporary courtesy" to "complimentary access".
Updates support actions for "temporary courtesy" plans to instead
use "complimentary access" to refer to these plans and actions.

Prep for implementing a complimentary access plan for Zulip Cloud.
2025-01-21 15:40:27 -08:00
Lauryn Menard
d3bc9bec1d billing: Rename migrate_customer_to_legacy_plan.
Renames migrate_customer_to_legacy_plan to
create_complimentary_access_plan for how this
function is currently used.

Prep for adding a complimentary access plan
for Zulip Cloud.
2025-01-21 15:40:27 -08:00
Lauryn Menard
757dd3e2a2 billing: Delete add_server_to_legacy_plan in favor of support actions.
As we can now add a complimentary access plan (formerly legacy plan)
to a remote server or remote realm via the support view, we no
longer use or need this management command for our billing admin.
2025-01-21 15:40:27 -08:00
Lauryn Menard
9fdaa9de0c portico: Fix logic for scheduled upgrade context variables.
Renames context variables used for the pricing model template for
when the customer has a current plan that has an upgrade to a new
plan tier scheduled.

Fixes the "Upgrade scheduled" note that was being shown when an
annual fixed-price plan has a subsequent fixed-price plan scheduled
to start when the current plan ends.

Prep for adding a complimentary access plan for Zulip Cloud.
2025-01-21 15:39:13 -08:00
Sahil Batra
5f8959397b message_edit: Set stream_topic only if content is edited.
stream_topic variable is needed only when updating content
so we set the field inside is_content_edited block.

Also added a comment clarifying about why we use orig_stream
for stream ID.
2025-01-21 15:33:45 -08:00
Sahil Batra
37f2c5bc78 message_edit: Refactor message edit code.
We add two dataclasses which stored the info for what
needs to be changed the original values to make the
code easy to read.
2025-01-21 15:33:45 -08:00
Sahil Batra
187cd18e12 message_edit: Refactor message edit code for updating content. 2025-01-21 15:33:45 -08:00
Sahil Batra
a2c6997879 message_edit: Always pass realm ID to update_message_cache.
We already have realm_id from message object passed to
do_update_message so there is no need to pass "None" to
update_message_cache for direct messages.

Previously, if "None" was passed to update_message_cache,
realm_id was eventually computed from stream if it was
a stream message and from Message object for direct messages.
But we always passed a value which is not "None" for stream
messages, and we can be sure that the message.realm will
always be the realm in which stream is present to which the
message was sent.
2025-01-21 15:33:45 -08:00
Lauryn Menard
522ca946cf templates: Use h2 elements instead of label elements on billing page.
The majority of the label elements on the billing page are not
associated with a form element and function more as section headers.

Also removes the padding/margin 25px rules for these so that the
rendered page is less fragile to cases where content could overlap,
such as when there was no text before the next expected charge h1
element.
2025-01-21 15:21:15 -08:00
Lauryn Menard
f936a8592b templates: Removed unneeded for attributes on label elements.
The for attribute for a label element is only used to associate it
with a form  control. Removes the for attribute and any related
div element id attributes that were not being used.
2025-01-21 15:21:15 -08:00
Lauryn Menard
ab4d2be36c templates: Remove classes from label elements in billing.html.
Some of the label elements had no class attributes set in the
template, and all of them were being rendered the same in the
billing page. Therefore the "inline-block" and "label-title"
classes can be removed without any visual changes to the page.
2025-01-21 15:21:15 -08:00
Saubhagya Patel
a3e322428b settings_ui: Refactor the do_settings_change() function.
Previously, the function reported success after a fixed delay of
500ms. With this change, we calculate the delay dynamically
to account for the time elapsed during the request and report
the success accordingly.
2025-01-21 15:18:05 -08:00