Commit Graph

19240 Commits

Author SHA1 Message Date
Niloth P
e731fb9eba integrations: Fix Jotform integration by accepting form-data payloads.
This does not add support for files.

Fixes part of #32460.

Co-authored by: PieterCK <pieterceka123@gmail.com>
2024-12-02 18:08:58 -08:00
Niloth P
2942a44224 test_classes: Support multipart/form-data content-type for webhooks.
Webhooks use "application/json" as the default content-type in
`check_webhook`, so the content-type will never be None when it reaches
`client_post`.
2024-12-02 18:08:58 -08:00
Niloth P
a0a1f55965 screenshot webhooks: Add support for multipart/form-data fixtures.
Add a common function for webhooks to convert multipart strings to dict.
This facilitates loading a multipart/form-data fixture as a file string,
and converting it.

This will allow testing integrations that use multipart/form-data,
and generating their example screenshots using a script.

Note that this only supports text fields, accommodation for binary files
is not included at the moment.
2024-12-02 18:08:58 -08:00
Niloth P
f99e1a5dba integrations: Improve message formatting for Jotform. 2024-12-02 18:08:58 -08:00
Sahil Batra
07f17af267 user_groups: Use new can_remove_members_group setting.
Permission to remove members from group is now controlled
by can_remove_members_group setting.
2024-12-02 17:38:46 -08:00
Sahil Batra
7e6a02b82d user_groups: Add setting to control who can remove members.
This commit adds a new setting to control who can remove
members from the group.
2024-12-02 17:38:44 -08:00
Sahil Batra
0f3d459d58 streams: Minor optimization in get_setting_values_for_group_settings.
Return early without doing membership query when there are no
anonymous groups.
2024-12-02 17:29:56 -08:00
Niloth P
53ece78de7 jenkins: Remove the secondary line text with its former name "Hudson". 2024-12-02 17:06:33 -08:00
Niloth P
40288b729c svn integration: Use "Subversion" as the display name. 2024-12-02 17:06:33 -08:00
Aman Agrawal
09e0ec35e1 narrow: Fix empty and_ depricated warning.
We can call `and_` with no arguments for `in-home` filter.

See https://gerrit.sqlalchemy.org/c/sqlalchemy/sqlalchemy/+/1682
for details.
2024-12-02 16:41:36 -08:00
Aman Agrawal
e5db6ac557 filter: Fix check for is personal filter. 2024-12-02 16:41:36 -08:00
Aman Agrawal
35ffaff1f6 tusd: Allow user to upload files during preregistration.
Allow user to upload files during preregistration. This will be used
to upload import data.

Co-authored-by: Alex Vandiver <alexmv@zulip.com>
2024-12-02 10:21:45 -08:00
Aman Agrawal
a8d0667b46 preregistration: Add field to track import progress.
We add a field to track user's progress and other details
during the import process.
2024-12-02 10:21:03 -08:00
Shubham Padia
6dcd4c4ca6 stream: Rename function to get defaults for stream permission groups. 2024-12-02 10:05:53 -08:00
Sahil Batra
0d5d305a47 register: Optmize computing can_invite_others_to_realm.
We already have fetched all the groups that the user is
member of, so we can just check if can_invite_users_group
is included in that list of groups like we do for similar
fields like can_create_public_streams, etc.

This helps us in saving a DB query.

Fixes #32408.
2024-12-01 19:33:55 -08:00
Shubham Padia
343741f621 stream: Fetch system groups in one query for group setting defaults.
Right now, the number of queries has remained the same, but when we add
more settings in the future, we won't be increasing the number of
queries when iterating over stream permission group settings.
2024-12-01 19:32:22 -08:00
Shubham Padia
771e076f1c stream: Fix expected fields for group settings in a generic way. 2024-12-01 19:32:22 -08:00
Shubham Padia
b64cb102c2 stream: Handle group settings in a generic way in check_stream_update. 2024-12-01 19:32:22 -08:00
Shubham Padia
1139977f64 stream: Make group setting handling generic for add subscriptions. 2024-12-01 19:32:22 -08:00
Shubham Padia
9f6764a70a stream: Do not use hardcoded default values for group settings.
We were using admins group as a hardcoded value for the default of
`can_remove_subscribers_group`, now we use a function to get the value
of the default group.
2024-12-01 19:32:22 -08:00
Aman Agrawal
81c345483e message_edit: Update stream active status when moving messages.
Update the active status of new stream where the messages are moved
into, if appropriate.

Tested by deleting all messages in a stream. Running the command
to update stream status to mark it inactive. Then moving messages
into the stream to check if the status is updated correctly to active.
2024-11-27 17:31:06 -08:00
Aman Agrawal
50256f4831 stream: Add field to track active status of stream. 2024-11-27 17:31:06 -08:00
Aman Agrawal
b2b233f0a7 test_subs: Remove query length check.
Quoting Alex:

This test came in during d6ef94f63f,
where the gross query was caused by a bare `select_related()`.
7d0c12aa3a
has enforced that we do not allow that construction anymore,
so IMHO this weird limit test should be removed,
rather than bumping it up every time we add something
useful to the query.
2024-11-27 17:31:05 -08:00
Anders Kaseorg
0048dfabd0 admin: Convert module to TypeScript.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-11-27 16:46:35 -08:00
Niloth P
a350de447b integrations: Make client_name a kwarg.
All integrations currently use their name as their client name as
well. Removed the redundancy of declaring the same name twice, while
retaining the support for client names.
2024-11-26 15:03:47 -08:00
Niloth P
a3b572f9cd integrations: Remove redundant display_name values. 2024-11-26 15:03:45 -08:00
Niloth P
d6fe41878e integrations: Fix $ position in Beeminder message template. 2024-11-26 12:43:31 -08:00
sujal shah
771d3b1434 invites: Enable adding users to user groups during invitations.
This commit allows users to be assigned to custom groups when
inviting them to join Zulip, similar to how channels are handled.
The implementation follows a similar pattern for adding pills,
ensuring consistency, as user groups and channels are parallel
in nature.

Fixes #24365.
2024-11-26 11:26:34 -08:00
Alya Abbott
c4c1edfa6e updates: Add update message (level=10). 2024-11-25 16:58:58 -08:00
Mateusz Mandera
4681c6154d unarchive_stream: Fix logic checking for name collision.
After #28478 we no longer change the name when deactivating a channel,
so this is particularly needed - now there's always a "collision" on
new_name.

Also fixes a second detail - the name should be matched
case-insensitively.
2024-11-25 16:22:11 -08:00
Alex Vandiver
19d115a9da email_mirror: Set a short timeout on parsing incoming emails.
This timeout needs to be short enough that we don't drop the RabbitMQ
connection. Also drop the offending message (by returning with no
further exception) so we don't hit a head-of-queue failure situation.

Ideally, the parser would just be lightning-fast, so this would never
happen.
2024-11-22 14:31:30 -08:00
Tim Abbott
c134cc3136 queue_processors: Disable missedmesssage worker on staging.
This worker isn't designed to have multiple copies running.
2024-11-22 14:31:30 -08:00
Tim Abbott
cc110cd7e4 migrations: Add progress indicator for imageattachment backfill.
These migrations can take a while, so it's worth having a progress
indicator.

Fixes #32232.
2024-11-22 14:24:36 -08:00
Shubham Padia
7cfa110934 settings: Realms with limited plans cannot change can_create_groups.
We do not allow realms on a limited plan to create groups. This commit
adds a banner to upgrade to the can_create_groups org setting and
disables editing it on the backend.
This commit also adds a new method called
`disable_group_permission_setting` to easily disable similar settings.
2024-11-22 13:42:59 -08:00
Shubham Padia
cccf1eacb1 groups: Restrict creating groups to non limited plans. 2024-11-22 13:42:59 -08:00
Sahil Batra
f197d881ca streams: Fix handling empty groups when computing setting values.
Since "Nobody" and other user-defined empty groups has no
members or subgroups, we need a UserGroup query.

Since we are doing UserGroup query, updated the code to
check whether the setting is set to anonymous group or
not just after doing UserGroup query and not in membership
queries.

Also, added tests to check query count when setting is set
to anonymous group.
2024-11-22 10:48:41 -08:00
Prakhar Pratyush
ded6bfd3f2 add_new_user_history: Remove the RECENT_MESSAGES_TIMEDELTA limit.
We give the new users some messages in their feed.

Earlier, we were including upto 1000 messages which were sent
within the last 12 weeks.

For realms with low-traffic it results in very few messages
being included in the new user's feed.

This commit removes the 12 week limit.
Now, we simply include upto 1000 recent messages.
2024-11-22 10:41:27 -08:00
Harsh
c570194ff2 tests: Add assertion for database queries count.
This commit extends the test for the `/api/v1/register` endpoint
for spectator users by adding an assertion to check the number
of database queries.

Fixes: #32409
2024-11-21 19:02:09 -08:00
Prakhar Pratyush
c5b3d2e434 custom_check: Add rule to avoid creating savepoints.
This commit adds a custom rule to check python files
and raise lint error if they have transaction.atomic used
without any argument or savepoint=True is used.

It helps to avoid creating unintended savepoints in the future.
2024-11-21 14:55:15 -08:00
Prakhar Pratyush
62b3e49075 transaction: Add 'savepoint=True' explicitly in tests, if used.
We create savepoint at a couple of places in backend tests
to avoid rollback due to error raised within test's transaction.

This commit explicitly adds 'savepoint=True' at those places.
2024-11-21 14:55:15 -08:00
Prakhar Pratyush
fdcd518e26 test_user_groups: Add durable=True to the independent transaction.
This commit adds `durable=True` to the short independent db transaction
in `UserGroupRaceConditionTestCase.tearDown` method.

This is as a part of our plan to explicitly mark all the
transaction.atomic calls with either 'savepoint=False' or
'durable=True' as required.
2024-11-21 14:55:15 -08:00
Prakhar Pratyush
b369177341 embed_links: Add savepoint=False to avoid creating savepoints.
It helps to avoid creating unintended savepoints in the future.

This is as a part of our plan to explicitly mark all the
transaction.atomic calls with either 'savepoint=False' or
'durable=True' as required.
2024-11-21 14:55:15 -08:00
Prakhar Pratyush
175104ea01 streams: Add 'ChannelEmailAddress' model.
This commit removes the 'email_token' field from the
'Stream' model, introduces a new model 'ChannelEmailAddress',
and backfills it.

This is a prep work towards our plan to generate unique
channel emails for different users, which can be used
to check post permissions at message send time.
2024-11-21 14:53:28 -08:00
Anders Kaseorg
801e267e00 integrations: Properly pass data-categories as a JSON array.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-11-21 14:41:36 -08:00
Sahil Batra
b6f895f61c streams: Optimize DB queries for computing permission setting values.
This commit updates code to use union so that we can compute values
for permission settings using a single DB query.
2024-11-21 11:28:54 -08:00
Sahil Batra
d1e76a9281 streams: Allow admins to unsubscribe others irrespective of setting. 2024-11-21 11:28:54 -08:00
Niloth P
619ada36ed integrations: Refine Mention example screenshot. 2024-11-21 11:09:40 -08:00
Niloth P
5de2a7115c integrations: Refine Gitea example screenshot. 2024-11-21 11:09:40 -08:00
Niloth P
e1f256c905 integrations: Refine Basecamp example screenshot. 2024-11-21 11:09:40 -08:00
Niloth P
8e17ef3507 integrations: Refine CircleCI example screenshots.
- Removed the extra screenshot.
- Updated the fixture used to generate the screenshot to use a more
suitable topic name and commit message description.
2024-11-21 11:09:40 -08:00