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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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
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.
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.
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.
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.
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.
- Removed the extra screenshot.
- Updated the fixture used to generate the screenshot to use a more
suitable topic name and commit message description.