Commit Graph

19553 Commits

Author SHA1 Message Date
Aman Agrawal
a2dd84541d auth: Fix 500 error on accessing selfhosting subdomain user login page.
selfhosting in not to valid subdomain for user login, so we render
invalid_realm page on that URL.
2025-02-12 12:43:23 -08:00
Sahil Batra
7eeb8a2c26 settings: Add personal setting to show or hide AI features.
Fixes #33231.
2025-02-12 12:05:04 -08:00
Sahil Batra
4ca28bb850 settings: Add setting to control permission for topic summarization. 2025-02-12 12:05:04 -08:00
Sahil Batra
9b38444e42 register: Add server_can_summarize_topics to response.
We now pass a new field in register response to tell
clients whether summarizing topics is enabled for the
server or not.
2025-02-12 12:05:04 -08:00
Mateusz Mandera
ac0af8d5ff install: Replace RTD links with our new permalinks. 2025-02-12 09:50:52 -08:00
Mateusz Mandera
a6f1916ab1 docs: Add endpoint for permalinks to some push notifs docs.
This will gives us the flexibility to edit our documentation, including
section names, without worrying about breaking links to docs hard-coded
in older releases / deployed self-hosted servers.
2025-02-12 09:50:52 -08:00
Alya Abbott
8f7c968408 help: Update self-hosted billing instructions.
Remove most references to Server 8.0 (not relevant for new installs).
2025-02-12 09:41:20 -08:00
Prakhar Pratyush
0e284464f1 api_docs: Improve docs related to mandatory topics. 2025-02-12 09:37:21 -08:00
Shubham Padia
552b464de7 stream: Notify all users with metadata access when unarchiving. 2025-02-12 09:35:17 -08:00
Shubham Padia
1db2487f1c stream: Guest users cannot get metadata access to channel via groups. 2025-02-12 09:35:17 -08:00
Tim Abbott
77d3029ec5 streams: Exclude guests from permissions groups access.
This adds missing enforcement and explanatory comments regarding
`allow_everyone_group` for these permissions code paths.
2025-02-11 15:09:16 -08:00
Shubham Padia
6e588b5b4a openapi: Make stream setting groups documentation up-to-date. 2025-02-11 15:09:16 -08:00
Shubham Padia
cbd23cc535 stream: Notify guest add subscribers group users for public channels.
For the test, we've only modified `test_rename_stream` to test for this
+ the guest susbcriber test case that was missing.
2025-02-11 15:09:16 -08:00
Shubham Padia
596aa2d357 subscription: Do not prefetch recursive user ids for single stream.
Pass a UserGroupMembershipDetails object to store
`user_recursive_group_ids` and fetch it only once max.
2025-02-11 15:09:16 -08:00
Shubham Padia
3893dcfcb8 stream: Do not send redundant events to users with metadata access.
When a user gets access to a private channel, they get a stream creation
event. Channel admins and users in `can_add_subscribers_group` already
have metadata access to a private channel and therefore do not need to
be notified.
2025-02-11 15:09:16 -08:00
Shubham Padia
33ea2b366e user_groups: Add function to get union of members of two groups.
This helps us important database queries when we want to perform a union
on the members of multiple user groups.
2025-02-11 15:09:16 -08:00
Shubham Padia
121af1c815 stream: Pass group id to get recursive group members.
Previously, we needed to pass the group to the function, which sometimes
meant having 1 extra query to fetch the user group when we just needed
the group id for this function.
2025-02-11 15:09:16 -08:00
Shubham Padia
35f9305acb stream: Modify flag to allow access for users with metadata access. 2025-02-11 15:09:16 -08:00
Shubham Padia
9725de99e9 stream: Move bulk_get_subscriber_peer_info to subscription_info.
We were not able to use
get_user_ids_with_metadata_access_via_permission_groups in the function
in question due to a cyclic dependency to `lib/streams.py`.
2025-02-11 15:09:16 -08:00
Shubham Padia
aabf42c2ce stream: Show private channel for their channel admins.
Fixes https://chat.zulip.org/#narrow/channel/101-design/topic/permissions.20for.20admin.20to.20unsubscribe.20others/near/2060197
Non realm admin users were not able to view private channels they were
an administrator of but not subscribed to it. This commit changes that.
We also made changes for those users to be able to see the subscribers
list.

The increase in query count in test_home and test_event_system can be
mitigated by only fetching recursive user group ids when needed within
the `validate_user_access_to_subscribers_helper` function. But that
would require refactoring that function to handle multiple streams and
subscriptions at once, along with changing how that function is used at
different places, which might be an exercise better left as a follow up.
We have optimised the code a little bit by not fetching the group ids in
case the current user is a realm admin.

We are fetching channel_admin_ids and users belonging to
can_add_subscribers_group directly in stream_subscription.py without
using the helper function
`get_user_ids_with_metadata_access_via_permission_groups`. This is due
to a cyclic dependency and we will move `bulk_get_subscriber_peer_info`
to another file in the next commit.
2025-02-11 15:09:16 -08:00
Shubham Padia
48eec43f48 stream: Notify users with metadata access on unarchiving stream. 2025-02-11 15:09:16 -08:00
Shubham Padia
f6301c24fe stream: Notify users with metadata access for lib/streams.py.
Users in `can_administer_channel_group` and `can_add_subscribers_group`
have access to private channel metadata. They should be notified of
relevant events.
We've only made relevant changes to lib/streams.py in this commit to
make the changes small and reviewable.
2025-02-11 15:09:16 -08:00
Shubham Padia
ca1aba9fc3 stream: Allow realm & channel admins to change private channel setting.
Previously, realm and channel admins were not able to change settings
for a private channel they were not subscribed to. This commit changes
that.

We have only added the exception for can_add_subscribers_group
and not privacy settings.

We also need proper functions with proper terminologies for content
and metadata access.
2025-02-11 15:09:16 -08:00
Shubham Padia
4d02a082a0 stream: Users with permission to administer can unsubscribe others.
We've also converted the function to check for permission to unsubscribe
others to accept a list of streams instead of checking each stream one
by one.
2025-02-11 15:09:16 -08:00
Shubham Padia
0f51b029a0 stream: User with just can add permissions should be able to add. 2025-02-11 15:09:16 -08:00
Shubham Padia
9e09a240d7 stream: Pass is_subscribed to check_basic_stream_access.
Earlier, we were passing the whole subscription object to the function
in order to check if the user was subscribed or not. In the future
commits, we want to check that without fetching and passing the complete
subscription object and this commit will help us do that.
2025-02-11 15:09:16 -08:00
Shubham Padia
98c5243c9b stream: Refactor to use functions for administer and add subscribers. 2025-02-11 15:09:16 -08:00
Lauryn Menard
2de2b22d55 help: Update for subscribe/unsubscribe user to channel terminology.
Instead of referring to users being added or removed from channels,
we now use subscribe or unsubscribed from channels.

Splits the article for adding and removing users from a channel
into separate articles: /help/subscribe-users-to-a-channel and
/help/unsubscribe-users-from-a-channel.

The URL redirects for the combined add/remove articles (for both
channel and stream terminology) go to the subscribe users to a
channel article.
2025-02-10 15:54:35 -08:00
apoorvapendse
5e6764373f copy_and_paste: Remove spannification logic for math expressions.
We instead use a turndown filter to get
what we want in case of inline expressions.

This removes most of the faulty logic
introduced by @apoorvapendse.

Fixes: https://chat.zulip.org/#narrow/channel/9-issues/topic/HTML.20paragraphs.20misconverted.20by.20copy.20and.20paste/near/2078384
2025-02-10 10:02:10 -08:00
Sahil Batra
4deb0a46a3 test_events: Refresh self.user_profile in verify_action.
For some cases, if the function called for testing events
changes some realm property using the realm object other
than the one derived from self.user_profile, then while
matching the states, self.user_profile still has the
old realm object.
2025-02-06 17:20:01 -08:00
Sahil Batra
58d21c432e event_schema: Update check_user_group_update to check multiple fields.
We can send data for multiple fields in user group update event
so this commit updates check_user_group_update accordingly.
2025-02-06 17:20:01 -08:00
Sahil Batra
8b068cf244 groups: Remove unused parameter from parse_group_setting_value.
setting_name parameter was not being used in
parse_group_setting_value function.
2025-02-06 17:20:01 -08:00
Vector73
cb6f0fd63c realm: Add setting to notify user on DMing guest.
Added `enable_guest_user_dm_warning` setting to decide whether
clients should show a warning when a user is composing to a guest
user in the organization.

Fixes #30078.

Co-authored-by: adnan-td <generaladnan139@gmail.com>
2025-02-06 12:15:41 -08:00
Aman Agrawal
d852aeffc4 message_summary: Raise error for error responses. 2025-02-06 12:03:24 -08:00
Aman Agrawal
2f5aea6604 message_summary: Add setting to put a monthly rate limit per user. 2025-02-06 12:03:24 -08:00
Aman Agrawal
7fb767c080 message_summary: Move cost per token configuration to settings. 2025-02-06 12:03:24 -08:00
Aman Agrawal
0bad785f03 message_summary: Log time to generate summary.
Mostly copy pasted things from markdown time logging.
2025-02-06 12:03:24 -08:00
Tim Abbott
b249830715 rocketchat: Harden parsing of custom emoji exports.
Apparently some exports have a weird `ObjectId("idstring")` typed
value here, that stringify to the actual string.
2025-02-05 13:41:19 -08:00
Lauryn Menard
4d0448f7c6 zoom: Extract user authentication helper for current oauth integration.
Prep for adding a server to server oauth zoom integration.
2025-02-05 13:36:25 -08:00
Lauryn Menard
901141e297 zoom: Create shared TypedDict for zoom call payloads.
Prep for adding a server to server oauth zoom integration.
2025-02-05 13:36:25 -08:00
Lauryn Menard
cb68d11ee3 tests: Create subclasses for create video call tests.
Separates tests for Zoom and Big Blue Button video call
intgrations into separate sublcasses, ZoomVideoCallTest
and BigBlueButtonVideoCallTest respectively.
2025-02-05 13:36:25 -08:00
Lauryn Menard
f13a1a48f7 realm: Refactor VIDEO_CHAT_PROVIDERS to have all possible options.
Refactors Realm.VIDEO_CHAT_PROIVDERS to have all the possible options
for video chat integrations, and use get_enabled_video_chat_providers
to compute the enabled options for the realm.

Prep for adding Zoom server to server video chat integration.
2025-02-05 13:36:25 -08:00
Anders Kaseorg
432ebd9a36 tests: Consume more streaming responses.
Fixes warnings like “ResourceWarning: unclosed file <_io.FileIO
name='/srv/zulip/var/4fc6d348-ccfe-43fa-8a2e-5b4ff5a15a66/test-backend/run_2304691/worker_7/test_uploads/files/2/d9/KYUsAKJ_g45NA7CojVbRW0C4/zulip.jpeg'
mode='rb' closefd=True>” with warnings enabled.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2025-02-05 13:16:12 -08:00
Prakhar Pratyush
25a0d97a2b zulip_updates: Raise error to explicitly log deactivated channel case.
`zulip_update_announcements_stream` should be set to None when its
channel is deactivated. This commit adds a safeguard to explicitly
raise an error if it is found in a deactivated state, indicating a
potential bug that needs investigation.

Without this commit, we won't face any runtime error but the error
raised would be at a much later stage i.e. while sending message,
with a generic error message i.e. "Not authorized to send to channel "
which would require further investigation to determine the root cause.

This commit helps with an early return and better error message
to debug.
2025-02-05 12:22:39 -08:00
Prakhar Pratyush
fe3199b954 zulip_updates: Add test to verify deactivated channel case.
This commit adds test to verify that we skip the update messages
and directly update the `zulip_update_announcements_level` to the
latest level when the configured `zulip_update_announcements_stream`
is deactivated.
2025-02-05 12:21:55 -08:00
Prakhar Pratyush
77baa05aa9 streams: Set realm stream fields to NULL when streams are deactivated.
When a stream configured for any of these settings is deactivated,
the corresponding realm settings should be set to NULL:
* new_stream_announcements_stream
* signup_announcements_stream
* zulip_update_announcements_stream
* moderation_request_channel

Earlier, we were not updating those realm settings to NULL.
We had helper functions like 'get_new_stream_announcements_stream'
to return None if the configured stream was deactivated.
But it makes more sense to just set them to NULL in DB.

This commit also includes a migration to clear those fields
if the configured channels are deactivated.
2025-02-05 12:21:55 -08:00
Prakhar Pratyush
4063aa4a00 zulip_updates: Replace 'stream' with 'channel' in group DM content.
This commit updates the initial group DM content sent to admins
to use the word 'channel' replacing 'stream'.

We used to call channel as stream.
2025-02-05 12:21:55 -08:00
Prakhar Pratyush
46f518fdbf api_docs: Improve topic parameter docs to list restricted values.
This commit updates the docs to specify that when topics are
required in an organization, the `topic` parameter in
`POST /messages` and `PATCH /messages/{message_id}` cannot be
* "(no topic)"
* an empty string
* `realm_empty_topic_display_name`.
2025-02-05 12:04:39 -08:00
Prakhar Pratyush
d4ae480985 api_docs: Update scheduled_message docs to specify empty string topic.
We missed to update this section of the docs while working
on feature level 334.
2025-02-05 12:04:39 -08:00
Prakhar Pratyush
23f16885d5 push_notifications: Show EMPTY_TOPIC_FALLBACK_NAME for topic="".
This commit adds support to display `Message.EMPTY_TOPIC_FALLBACK_NAME`
value (translated) in the push notifications for topics having the
actual value of empty string.

Fixes part of #32996.
2025-02-05 05:56:07 -08:00