Earlier, for new realm with zulip_update_announcements_stream
set to None, an assertion error was raised in
'is_group_direct_message_sent_to_admins_within_days' because
no 'None' to new level change took place for such realm.
A new realm is on the latest level and a default stream is set.
This commit updates the logic to simply skip sending
update messages as the stream was manually set to None
in such cases.
Removes the 'onboarding_steps' field on 'UserProfile'
model which is no longer used.
It was introduced back in 2013 (b5e22bf), and is no
longer used.
Fixes part of #30043.
This commit adds a new helper function to create or update
a UserGroup object for a setting. We could have used existing
update_or_create_user_group_for_setting but that also validates
user IDs and subgroup IDs which we can skip in tests.
This commit fixes the code store correct old value in audit
log data when changing can_mention_group setting from a
anonymous group to another anonymous group. The bug was
because the old value was being computed after updating
the UserGroup object with new members and subgroups and
is fixed by computing the old value for all the cases
and passing it to do_change_user_group_permission_setting.
requests transforms the base urllib3 exceptions into
requests.RequestExceptions -- but only within code that it is
running. When parsing the streaming body in fetch_open_graph_image,
the read itself (inside lxml) may trigger urllib3 to raise its own
timeout error -- which escapes the current catch of
requests.RequestExceptions.
Catch both requests and urllib3 exceptions.
This commit replaces occurrences of realm_uri with realm_url in
"context_processors.py" and related templates.
With by-hand translation updates for German (also updated in
Transifex) to avoid breaking the i18n system tests that use some
modified strings.
Co-authored-by: Junyao Chen <junyao.chen@socitydao.org>
This commit replaces occurrences of realm_uri with realm_url in email templates
and other related backend files.
Co-authored-by: Junyao Chen <junyao.chen@socitydao.org>
This adds `--automated` and `--no-automated` flags to all Zulip
management commands, whose default is based on if STDIN is a TTY.
This enables cron jobs and supervisor commands to continue to report
to Sentry, and manually-run commands (when reporting to Sentry does
not provide value, since the user can see them) to not.
Note that this only applies to Zulip commands -- core Django
commands (e.g. `./manage.py`) do not grow support for `--automated`
and will always report exceptions to Sentry.
`manage.py` subcommands in the `upgrade` and `restart-server` paths
are marked as `--automated`, since those may be run semi-unattended,
and they are useful to log to Sentry.
Earlier, we were using 'send_event' in 'do_update_message'
which can lead to a situation where we enqueue events but
the transaction fails at a later stage.
Events should not be sent until we know we're not rolling back.
Earlier, we were using 'send_event' which can lead to a situation
where we enqueue events but the transaction fails at a later stage.
Events should not be sent until we know we're not rolling back.
The documentation Creates a shared UserStatus schema that's used for
the return value of this new endpoint and for the existing user_status
objects returned by the register queue endpoint.
Co-authored-by: Suyash Vardhan Mathur <suyash.mathur@research.iiit.ac.in>
Fixes#19079.
This commit updates code, majorly in tests, to use
setting values from enums instead of directly using
the constants defined in Realm.
We still have those constants defined Realm as they
are used in a couple of places where the same code
is used for different settings. These will be
handled later.
This commit fixes comment about subscribing to default streams
in set_up_streams_for_new_human_user to explain the current
logic after changes in 69ba580a54.
In e726012244, we removed the
@transaction.atomic decorator from the function
'bulk_set_user_topic_visibility_policy_in_database'.
We should keep it to avoid adding it to the caller
of this function, when reused in the future.
This commits fixes the code which checks group mention permission
to handle anonymous user groups correctly. Basically we were
not checking whether the UserGroup is linked to a NamedUserGroup
and directly accessing named_user_group which results in an
error.
We also update the error messages to include the group name
which has permission to mention the groups since now there
might be a comnbination of groups and users who has permission
to mention the group.
This commit also adds tests to check sending and editing messages
when can_mention_group is set to a anonymous user group.
Even though there was a stream/channel ID being passed to the test
function for archive_stream, it wasn't being used in the test as
it was reset to a new stream created/subscribed in the function.
Updates the test function to remove the unused stream/channel ID
parameter, and updates the usage example for to use channel instead
of stream where appropriate.
Part of stream to channel rename project.
Updates comments that are displayed in the javascript examples for
various endpoints to use channel instead of stream.
Part of stream to channel rename project.
Updates narrow parameters in the javascript and python usage
examples for the get_messages endpoint to use the "channel"
operator instead of the "stream" operator.
Part of the stream to channel rename project.
Updates the API doc for /calls/bigbluebutton/create endpoint to
use channel in descriptions instead of stream.
Part of the stream to channel rename project.
Updates the API doc for /streams/{stream_id}/delete_topic endpoint to
use channel in descriptions instead of stream.
Part of the stream to channel rename project.
Updates the API doc for /streams/{stream_id}/email_address endpoint to
use channel in descriptions instead of stream.
Part of the stream to channel rename project.
Updates the API doc for PATCH /streams/{stream_id} endpoint to
use channel in descriptions instead of stream.
Part of the stream to channel rename project.
Updates the API doc for DELETE /streams/{stream_id} endpoint to
use channel in descriptions instead of stream.
Part of the stream to channel rename project.
Updates the API doc for GET /streams/{stream_id} endpoint to
use channel in descriptions instead of stream.
Part of the stream to channel rename project.
Updates the API doc for GET /streams/{stream_id}/members endpoint to
use channel in descriptions instead of stream.
Part of the stream to channel rename project.
Updates the API doc for POST /invites/multiuse endpoint to use channel
in descriptions instead of stream.
Part of the stream to channel rename project.
Updates the API doc for POST /users/me/subscriptions/properties
endpoint to use channel in descriptions instead of stream.
Part of the stream to channel rename project.
Updates the API doc for PATCH /realm/user_settings_defaults
endpoint to use channel in descriptions instead of stream.
Part of the stream to channel rename project.
Updates the API doc for DELETE /realm/emoji/{emoji_name}
endpoint to use channel in descriptions instead of stream.
Part of the stream to channel rename project.
Updates the API doc for /users/{user_id}/subscriptions/{stream_id}
endpoint to use channel in descriptions instead of stream.
Part of the stream to channel rename project.
Updates the API doc for /users/me/muted_users/{muted_user_id} endpoint
to use channel in descriptions instead of stream.
Part of the stream to channel rename project.
Updates the API doc for PATCH /users/me/subscriptions/muted_topics
endpoint to use channel in descriptions instead of stream.
Part of the stream to channel rename project.
Updates the API doc for DELETE /users/me/subscriptions endpoint to
use channel in descriptions instead of stream.
Part of the stream to channel rename project.
Updates the API doc for PATCH /users/me/subscriptions endpoint to
use channel in descriptions instead of stream.
Part of the stream to channel rename project.
Updates the API doc for POST /users/me/subscriptions endpoint to
use channel in descriptions instead of stream.
Part of the stream to channel rename project.
Updates the API doc for GET /users/me/subscriptions endpoint to
use channel in descriptions instead of stream.
Part of the stream to channel rename project.
Updates the API doc for /users/me/{stream_id}/topics endpoint to
use channel in descriptions instead of stream.
Part of the stream to channel rename project.
Updates the API doc for PATCH /messages/{message_id} endpoint to
use channel in descriptions instead of stream.
Part of the stream to channel rename project.
Updates the API doc for GET /messages/matches_narrow endpoint to
use channel in descriptions instead of stream.
Part of the stream to channel rename project.
Updates the API doc for GET /messages/{message_id}/history endpoint to
use channel in descriptions instead of stream.
Part of the stream to channel rename project.
Updates the API doc for DELETE /default_streams endpoint to use channel
in descriptions instead of stream.
Part of the stream to channel rename project.
Updates the API doc for PATCH /scheduled_messages/{scheduled_message_id}
endpoint to use channel in descriptions instead of stream.
Part of the stream to channel rename project.
Updates the API documentation for the POST /scheduled_message endpoint
to use channel in descriptions instead of stream.
Part of the stream to channel rename project.
Updates the API documentation for the POST /drafts endpoint to
use channel in descriptions instead of stream.
Part of the stream to channel rename project.
Updates the API documentation for the /mark_topic_as_read endpoint to
use channel in descriptions instead of stream.
Part of the stream to channel rename project.
Updates the API documentation for the /mark_stream_as_read endpoint to
use channel in descriptions instead of stream.
Part of the stream to channel rename project.
Updates the API documentation for the /get_stream_id endpoint to
use channel in descriptions instead of stream.
Part of the stream to channel rename project.
Updates description's in /api/get-events to use channel instead
of stream.
Note that any shared schemas used for this endpoint's documentation
will be updated in other commits in this series.
Part of stream to channel rename project.
Earlier, we were using 'send_event' & 'queue_json_publish' in
'do_send_messages' which can lead to a situation where we enqueue
events but the transaction fails at a later stage.
Events should not be sent until we know we're not rolling back.
It's going to be helpful in the future to record the reason for realm
deactivation.
- For information tracking
- For making a distinction between cases where we can allow realm owners
to reactivate their realm via a self-serve flow (e.g.
"owner_request") vs where we can't (ToS abuse).
This commit renames are_both_setting_values_equal function
to are_both_group_setting_values_equal to make it clear
that this function is used to compare value of group
settings.
This commit moves validate_group_setting_value_change,
are_both_setting_values_equal and parse_group_setting_value
functions, which are used for updating the group settings, to
"zerver.lib.user_groups" as these functions will also be used for
group based realm and stream settings and "zerver.lib.user_groups"
file seems a better place to place such functions which are used
at multiple places.
For same reasons, we also move GroupSettingChangeRequest dataclass
to "zerver.lib.user_groups" file.
If an invalid timezone (such as +32h) was provided, the
timestamp.astimezone call would throw an exception, causing the
message send to fail. Replace that with a user-facing error.
Fixes#19658.
This is a follow-up to #29425. It assigns creator to three streams
that are used in tests and another two that aren't. For tests,
we assign a guest, an admin and an owner as creator.
To help users focus on the onboarding experience, we no longer
send the introductory "Zulip updates" message as a part of
onboarding.
Now, we send the introductory message just before the first
update message.
Fixes#30053.
This commit removes set_up_db, which called realm.save to
update the settings, and its calls are replaced with either
self.assertEqual (which is enough to verify the initial value)
or a "do_.." function call to set the setting to initial value.
It is better to avoid calling "realm.save" and instead use the
"do_.." functions to set the settings.
There are places where it is easy to just call "do_.." function
as default value is not the first value in the list of test values.