Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

views: Sort parameters alphabetically.

opmkumar4aab379e2abf
diff --git a/zerver/views/auth.py b/zerver/views/auth.py
index 4302ed71c14..b1d4fbfa3c3 100644
--- a/zerver/views/auth.py
+++ b/zerver/views/auth.py
@@ -162,14 +162,14 @@ def maybe_send_to_registration(
request: HttpRequest,
email: str,
*,
- full_name: str = "",
- role: int | None = None,
- mobile_flow_otp: str | None = None,
desktop_flow_otp: str | None = None,
+ full_name: str = "",
+ full_name_validated: bool = False,
is_signup: bool = False,
+ mobile_flow_otp: str | None = None,
multiuse_object_key: str = "",
- full_name_validated: bool = False,
params_to_store_in_authenticated_session: dict[str, str] | None = None,
+ role: int | None = None,
) -> HttpResponse:
"""Given a successful authentication for an email address (i.e. we've
confirmed the user controls the email address) that does not
@@ -522,8 +522,8 @@ def create_response_for_otp_flow(
def remote_user_sso(
request: HttpRequest,
*,
- mobile_flow_otp: str | None = None,
desktop_flow_otp: str | None = None,
+ mobile_flow_otp: str | None = None,
next: str = "/",
) -> HttpResponse:
subdomain = get_subdomain(request)
@@ -634,10 +634,10 @@ def oauth_redirect_to_root(
# positional parameters.
/,
*,
- next: str | None = None,
- multiuse_object_key: str = "",
- mobile_flow_otp: str | None = None,
desktop_flow_otp: str | None = None,
+ mobile_flow_otp: str | None = None,
+ multiuse_object_key: str = "",
+ next: str | None = None,
) -> HttpResponse:
main_site_url = settings.ROOT_DOMAIN_URI + url
if settings.SOCIAL_AUTH_SUBDOMAIN is not None and sso_type == "social":
diff --git a/zerver/views/channel_folders.py b/zerver/views/channel_folders.py
index dd789bbc9a6..f25ea664f3f 100644
--- a/zerver/views/channel_folders.py
+++ b/zerver/views/channel_folders.py
@@ -31,8 +31,8 @@ def create_channel_folder(
request: HttpRequest,
user_profile: UserProfile,
*,
- name: Annotated[str, StringConstraints(max_length=ChannelFolder.MAX_NAME_LENGTH)],
description: Annotated[str, StringConstraints(max_length=ChannelFolder.MAX_DESCRIPTION_LENGTH)],
+ name: Annotated[str, StringConstraints(max_length=ChannelFolder.MAX_NAME_LENGTH)],
) -> HttpResponse:
realm = user_profile.realm
check_channel_folder_name(name, realm)
@@ -59,9 +59,9 @@ def update_channel_folder(
user_profile: UserProfile,
*,
channel_folder_id: PathOnly[int],
- name: str | None = None,
description: str | None = None,
is_archived: Json[bool] | None = None,
+ name: str | None = None,
) -> HttpResponse:
channel_folder = get_channel_folder_by_id(channel_folder_id, user_profile.realm)
diff --git a/zerver/views/custom_profile_fields.py b/zerver/views/custom_profile_fields.py
index e7ad5fb4ac0..7f22b764afb 100644
--- a/zerver/views/custom_profile_fields.py
+++ b/zerver/views/custom_profile_fields.py
@@ -171,13 +171,13 @@ def create_realm_custom_profile_field(
request: HttpRequest,
user_profile: UserProfile,
*,
- name: Annotated[str, StringConstraints(strip_whitespace=True)] = "",
- hint: str = "",
+ display_in_profile_summary: Json[bool] = False,
+ editable_by_user: Json[bool] = True,
field_data: Json[ProfileFieldData] | None = None,
field_type: Json[int],
- display_in_profile_summary: Json[bool] = False,
+ hint: str = "",
+ name: Annotated[str, StringConstraints(strip_whitespace=True)] = "",
required: Json[bool] = False,
- editable_by_user: Json[bool] = True,
) -> HttpResponse:
if field_data is None:
field_data = {}
@@ -234,13 +234,13 @@ def update_realm_custom_profile_field(
request: HttpRequest,
user_profile: UserProfile,
*,
+ display_in_profile_summary: Json[bool] | None = None,
+ editable_by_user: Json[bool] | None = None,
+ field_data: Json[ProfileFieldData] | None = None,
field_id: PathOnly[int],
- name: Annotated[str, StringConstraints(strip_whitespace=True)] | None = None,
hint: str | None = None,
- field_data: Json[ProfileFieldData] | None = None,
+ name: Annotated[str, StringConstraints(strip_whitespace=True)] | None = None,
required: Json[bool] | None = None,
- display_in_profile_summary: Json[bool] | None = None,
- editable_by_user: Json[bool] | None = None,
) -> HttpResponse:
realm = user_profile.realm
try:
diff --git a/zerver/views/drafts.py b/zerver/views/drafts.py
index 323dfd47af2..803b270c817 100644
--- a/zerver/views/drafts.py
+++ b/zerver/views/drafts.py
@@ -39,8 +39,8 @@ def edit_draft(
request: HttpRequest,
user_profile: UserProfile,
*,
- draft_id: PathOnly[int],
draft: Json[DraftData],
+ draft_id: PathOnly[int],
) -> HttpResponse:
do_edit_draft(draft_id, draft, user_profile)
return json_success(request)
diff --git a/zerver/views/events_register.py b/zerver/views/events_register.py
index 63ae7068d8e..94d2ab9943a 100644
--- a/zerver/views/events_register.py
+++ b/zerver/views/events_register.py
@@ -40,19 +40,19 @@ def events_register_backend(
request: HttpRequest,
maybe_user_profile: UserProfile | AnonymousUser,
*,
- apply_markdown: Json[bool] = False,
- client_gravatar_raw: Annotated[Json[bool | None], ApiParamConfig("client_gravatar")] = None,
- slim_presence: Json[bool] = False,
- presence_history_limit_days: Json[int] | None = None,
all_public_streams: Json[bool] | None = None,
- include_subscribers: Json[bool] = False,
+ apply_markdown: Json[bool] = False,
client_capabilities: Json[ClientCapabilities] = DEFAULT_CLIENT_CAPABILITIES,
+ client_gravatar_raw: Annotated[Json[bool | None], ApiParamConfig("client_gravatar")] = None,
event_types: Json[list[str]] | None = None,
fetch_event_types: Json[list[str]] | None = None,
+ include_subscribers: Json[bool] = False,
narrow: Json[NarrowT] | None = None,
+ presence_history_limit_days: Json[int] | None = None,
queue_lifespan_secs: Annotated[
Json[int], ApiParamConfig(documentation_status=DocumentationStatus.DOCUMENTATION_PENDING)
] = 0,
+ slim_presence: Json[bool] = False,
) -> HttpResponse:
if narrow is None:
narrow = []
diff --git a/zerver/views/invite.py b/zerver/views/invite.py
index 48dff311358..c752db92572 100644
--- a/zerver/views/invite.py
+++ b/zerver/views/invite.py
@@ -127,16 +127,16 @@ def invite_users_backend(
request: HttpRequest,
user_profile: UserProfile,
*,
- invitee_emails_raw: Annotated[str, ApiParamConfig("invitee_emails")],
- invite_expires_in_minutes: Json[int | None] = INVITATION_LINK_VALIDITY_MINUTES,
+ group_ids: Json[list[int]] | None = None,
+ include_realm_default_subscriptions: Json[bool] = False,
invite_as: Annotated[
Json[int],
check_int_in_validator(list(PreregistrationUser.INVITE_AS.values())),
] = PreregistrationUser.INVITE_AS["MEMBER"],
+ invite_expires_in_minutes: Json[int | None] = INVITATION_LINK_VALIDITY_MINUTES,
+ invitee_emails_raw: Annotated[str, ApiParamConfig("invitee_emails")],
notify_referrer_on_join: Json[bool] = True,
stream_ids: Json[list[int]],
- group_ids: Json[list[int]] | None = None,
- include_realm_default_subscriptions: Json[bool] = False,
) -> HttpResponse:
if not user_profile.can_invite_users_by_email():
# Guest users case will not be handled here as it will
@@ -238,14 +238,14 @@ def generate_multiuse_invite_backend(
request: HttpRequest,
user_profile: UserProfile,
*,
- invite_expires_in_minutes: Json[int | None] = INVITATION_LINK_VALIDITY_MINUTES,
+ group_ids: Json[list[int]] | None = None,
+ include_realm_default_subscriptions: Json[bool] = False,
invite_as: Annotated[
Json[int],
check_int_in_validator(list(PreregistrationUser.INVITE_AS.values())),
] = PreregistrationUser.INVITE_AS["MEMBER"],
+ invite_expires_in_minutes: Json[int | None] = INVITATION_LINK_VALIDITY_MINUTES,
stream_ids: Json[list[int]] | None = None,
- group_ids: Json[list[int]] | None = None,
- include_realm_default_subscriptions: Json[bool] = False,
) -> HttpResponse:
if stream_ids is None:
stream_ids = []
diff --git a/zerver/views/message_edit.py b/zerver/views/message_edit.py
index 961f6a89605..1ed64754296 100644
--- a/zerver/views/message_edit.py
+++ b/zerver/views/message_edit.py
@@ -111,8 +111,8 @@ def get_message_edit_history(
request: HttpRequest,
user_profile: UserProfile,
*,
- message_id: PathOnly[NonNegativeInt],
allow_empty_topic_name: Json[bool] = False,
+ message_id: PathOnly[NonNegativeInt],
) -> HttpResponse:
user_realm_message_edit_history_visibility_policy = (
user_profile.realm.message_edit_history_visibility_policy
@@ -149,14 +149,14 @@ def update_message_backend(
request: HttpRequest,
user_profile: UserProfile,
*,
+ content: str | None = None,
message_id: PathOnly[NonNegativeInt],
- stream_id: Json[NonNegativeInt] | None = None,
- topic_name: OptionalTopic = None,
+ prev_content_sha256: str | None = None,
propagate_mode: Literal["change_later", "change_one", "change_all"] = "change_one",
- send_notification_to_old_thread: Json[bool] = False,
send_notification_to_new_thread: Json[bool] = True,
- content: str | None = None,
- prev_content_sha256: str | None = None,
+ send_notification_to_old_thread: Json[bool] = False,
+ stream_id: Json[NonNegativeInt] | None = None,
+ topic_name: OptionalTopic = None,
) -> HttpResponse:
updated_message_result = check_update_message(
user_profile,
@@ -224,9 +224,9 @@ def json_fetch_raw_message(
request: HttpRequest,
maybe_user_profile: UserProfile | AnonymousUser,
*,
- message_id: PathOnly[NonNegativeInt],
- apply_markdown: Json[bool] = True,
allow_empty_topic_name: Json[bool] = False,
+ apply_markdown: Json[bool] = True,
+ message_id: PathOnly[NonNegativeInt],
) -> HttpResponse:
if not maybe_user_profile.is_authenticated:
realm = get_valid_realm_from_request(request)
diff --git a/zerver/views/message_fetch.py b/zerver/views/message_fetch.py
index 6823e45e2d6..d104e010639 100644
--- a/zerver/views/message_fetch.py
+++ b/zerver/views/message_fetch.py
@@ -110,20 +110,20 @@ def get_messages_backend(
request: HttpRequest,
maybe_user_profile: UserProfile | AnonymousUser,
*,
+ allow_empty_topic_name: Json[bool] = False,
anchor_val: Annotated[str | None, ApiParamConfig("anchor")] = None,
+ apply_markdown: Json[bool] = True,
+ client_gravatar: Json[bool] = True,
+ client_requested_message_ids: Annotated[
+ Json[list[NonNegativeInt] | None], ApiParamConfig("message_ids")
+ ] = None,
include_anchor: Json[bool] = True,
- num_before: Json[NonNegativeInt] = 0,
- num_after: Json[NonNegativeInt] = 0,
narrow: Json[list[NarrowParameter] | None] = None,
+ num_after: Json[NonNegativeInt] = 0,
+ num_before: Json[NonNegativeInt] = 0,
use_first_unread_anchor_val: Annotated[
Json[bool], ApiParamConfig("use_first_unread_anchor")
] = False,
- client_gravatar: Json[bool] = True,
- apply_markdown: Json[bool] = True,
- allow_empty_topic_name: Json[bool] = False,
- client_requested_message_ids: Annotated[
- Json[list[NonNegativeInt] | None], ApiParamConfig("message_ids")
- ] = None,
) -> HttpResponse:
# User has to either provide message_ids or both num_before and num_after.
if (
diff --git a/zerver/views/message_flags.py b/zerver/views/message_flags.py
index 4c86ccd8eba..d74f6ce3fdc 100644
--- a/zerver/views/message_flags.py
+++ b/zerver/views/message_flags.py
@@ -46,9 +46,9 @@ def update_message_flags(
request: HttpRequest,
user_profile: UserProfile,
*,
+ flag: str,
messages: Json[list[int]],
operation: Annotated[str, ApiParamConfig("op")],
- flag: str,
) -> HttpResponse:
request_notes = RequestNotes.get_notes(request)
assert request_notes.log_data is not None
@@ -81,12 +81,12 @@ def update_message_flags_for_narrow(
user_profile: UserProfile,
*,
anchor_val: Annotated[str, ApiParamConfig("anchor")],
+ flag: str,
include_anchor: Json[bool] = True,
- num_before: Json[NonNegativeInt],
- num_after: Json[NonNegativeInt],
narrow: Json[list[NarrowParameter] | None],
+ num_after: Json[NonNegativeInt],
+ num_before: Json[NonNegativeInt],
operation: Annotated[str, ApiParamConfig("op")],
- flag: str,
) -> HttpResponse:
anchor = parse_anchor_value(anchor_val, use_first_unread_anchor=False)
@@ -166,8 +166,8 @@ def mark_topic_as_read(
request: HttpRequest,
user_profile: UserProfile,
*,
- stream_id: Json[int],
topic_name: str,
+ stream_id: Json[int],
) -> HttpResponse:
stream, sub = access_stream_by_id(user_profile, stream_id)
assert stream.recipient_id is not None
diff --git a/zerver/views/message_report.py b/zerver/views/message_report.py
index a343eabd816..af4e15cd8fc 100644
--- a/zerver/views/message_report.py
+++ b/zerver/views/message_report.py
@@ -20,10 +20,10 @@ def report_message_backend(
user_profile: UserProfile,
message_id: int,
*,
- report_type: Annotated[str, check_string_in_validator(Realm.REPORT_MESSAGE_REASONS)],
description: Annotated[
str, StringConstraints(max_length=Realm.MAX_REPORT_MESSAGE_EXPLANATION_LENGTH)
] = "",
+ report_type: Annotated[str, check_string_in_validator(Realm.REPORT_MESSAGE_REASONS)],
) -> HttpResponse:
if report_type == "other" and description == "":
raise JsonableError(_("An explanation is required."))
diff --git a/zerver/views/message_send.py b/zerver/views/message_send.py
index 072fc958e30..2ea8fff28ea 100644
--- a/zerver/views/message_send.py
+++ b/zerver/views/message_send.py
@@ -132,25 +132,25 @@ def send_message_backend(
request: HttpRequest,
user_profile: UserProfile,
*,
- req_type: Annotated[Literal["direct", "private", "stream", "channel"], ApiParamConfig("type")],
- req_to: Annotated[str | None, ApiParamConfig("to")] = None,
- req_sender: Annotated[
- str | None, ApiParamConfig("sender", documentation_status=DOCUMENTATION_PENDING)
- ] = None,
forged_str: Annotated[
str | None, ApiParamConfig("forged", documentation_status=DOCUMENTATION_PENDING)
] = None,
- topic_name: OptionalTopic = None,
- message_content: Annotated[str, ApiParamConfig("content")],
- widget_content: Annotated[
- str | None, ApiParamConfig("widget_content", documentation_status=DOCUMENTATION_PENDING)
- ] = None,
local_id: str | None = None,
+ message_content: Annotated[str, ApiParamConfig("content")],
queue_id: str | None = None,
+ read_by_sender: Json[bool] | None = None,
+ req_sender: Annotated[
+ str | None, ApiParamConfig("sender", documentation_status=DOCUMENTATION_PENDING)
+ ] = None,
+ req_to: Annotated[str | None, ApiParamConfig("to")] = None,
+ req_type: Annotated[Literal["direct", "private", "stream", "channel"], ApiParamConfig("type")],
time: Annotated[
Json[float] | None, ApiParamConfig("time", documentation_status=DOCUMENTATION_PENDING)
] = None,
- read_by_sender: Json[bool] | None = None,
+ topic_name: OptionalTopic = None,
+ widget_content: Annotated[
+ str | None, ApiParamConfig("widget_content", documentation_status=DOCUMENTATION_PENDING)
+ ] = None,
) -> HttpResponse:
recipient_type_name = req_type
if recipient_type_name == "direct":
diff --git a/zerver/views/navigation_views.py b/zerver/views/navigation_views.py
index 2b545a5046b..3e9a2718794 100644
--- a/zerver/views/navigation_views.py
+++ b/zerver/views/navigation_views.py
@@ -79,8 +79,8 @@ def update_navigation_view(
user_profile: UserProfile,
fragment: Annotated[str, StringConstraints(strip_whitespace=True, min_length=1)],
*,
- name: Annotated[str, StringConstraints(strip_whitespace=True, min_length=1)] | None = None,
is_pinned: Json[bool] | None = None,
+ name: Annotated[str, StringConstraints(strip_whitespace=True, min_length=1)] | None = None,
) -> HttpResponse:
"""
Update an existing navigation view for the user.
diff --git a/zerver/views/presence.py b/zerver/views/presence.py
index be39ef2bedb..1db352d37ac 100644
--- a/zerver/views/presence.py
+++ b/zerver/views/presence.py
@@ -84,15 +84,15 @@ def update_user_status_backend(
user_profile: UserProfile,
*,
away: Json[bool] | None = None,
- status_text: Annotated[
- str | None, StringConstraints(strip_whitespace=True, max_length=60)
- ] = None,
- emoji_name: str | None = None,
emoji_code: str | None = None,
+ emoji_name: str | None = None,
# TODO: emoji_type is the more appropriate name for this parameter, but changing
# that requires nontrivial work on the API documentation, since it's not clear
# that the reactions endpoint would prefer such a change.
emoji_type: Annotated[str | None, ApiParamConfig("reaction_type")] = None,
+ status_text: Annotated[
+ str | None, StringConstraints(strip_whitespace=True, max_length=60)
+ ] = None,
) -> HttpResponse:
if status_text is not None:
status_text = status_text.strip()
@@ -153,12 +153,12 @@ def update_active_status_backend(
request: HttpRequest,
user_profile: UserProfile,
*,
- status: str,
- ping_only: Json[bool] = False,
+ history_limit_days: Json[int] | None = None,
+ last_update_id: Json[int] | None = None,
new_user_input: Json[bool] = False,
+ ping_only: Json[bool] = False,
slim_presence: Json[bool] = False,
- last_update_id: Json[int] | None = None,
- history_limit_days: Json[int] | None = None,
+ status: str,
) -> HttpResponse:
if last_update_id is not None:
# This param being submitted by the client, means they want to use
diff --git a/zerver/views/push_notifications.py b/zerver/views/push_notifications.py
index be2046be296..20025cb7808 100644
--- a/zerver/views/push_notifications.py
+++ b/zerver/views/push_notifications.py
@@ -55,8 +55,8 @@ def add_apns_device_token(
request: HttpRequest,
user_profile: UserProfile,
*,
- token: str,
appid: ApnsAppId,
+ token: str,
) -> HttpResponse:
validate_token(token, PushDeviceToken.APNS)
add_push_device_token(user_profile, token, PushDeviceToken.APNS, ios_app_id=appid)
diff --git a/zerver/views/reactions.py b/zerver/views/reactions.py
index 8817f17854d..27f58ccaf32 100644
--- a/zerver/views/reactions.py
+++ b/zerver/views/reactions.py
@@ -19,8 +19,8 @@ def add_reaction(
user_profile: UserProfile,
message_id: int,
*,
- emoji_name: str,
emoji_code: str | None = None,
+ emoji_name: str,
reaction_type: str | None = None,
) -> HttpResponse:
check_add_reaction(user_profile, message_id, emoji_name, emoji_code, reaction_type)
@@ -36,8 +36,8 @@ def remove_reaction(
user_profile: UserProfile,
message_id: int,
*,
- emoji_name: str | None = None,
emoji_code: str | None = None,
+ emoji_name: str | None = None,
reaction_type: str = "unicode_emoji",
) -> HttpResponse:
message = access_message(user_profile, message_id, lock_message=True, is_modifying_message=True)
diff --git a/zerver/views/realm.py b/zerver/views/realm.py
index d665504c573..27bab5ccd73 100644
--- a/zerver/views/realm.py
+++ b/zerver/views/realm.py
@@ -93,39 +93,60 @@ def update_realm(
request: HttpRequest,
user_profile: UserProfile,
*,
- name: Annotated[str | None, StringConstraints(max_length=Realm.MAX_REALM_NAME_LENGTH)] = None,
+ allow_message_editing: Json[bool] | None = None,
+ authentication_methods: Json[dict[str, Any]] | None = None,
+ avatar_changes_disabled: Json[bool] | None = None,
+ can_access_all_users_group: Json[GroupSettingChangeRequest] | None = None,
+ can_add_custom_emoji_group: Json[GroupSettingChangeRequest] | None = None,
+ can_add_subscribers_group: Json[GroupSettingChangeRequest] | None = None,
+ can_create_bots_group: Json[GroupSettingChangeRequest] | None = None,
+ can_create_groups: Json[GroupSettingChangeRequest] | None = None,
+ can_create_private_channel_group: Json[GroupSettingChangeRequest] | None = None,
+ can_create_public_channel_group: Json[GroupSettingChangeRequest] | None = None,
+ can_create_web_public_channel_group: Json[GroupSettingChangeRequest] | None = None,
+ can_create_write_only_bots_group: Json[GroupSettingChangeRequest] | None = None,
+ can_delete_any_message_group: Json[GroupSettingChangeRequest] | None = None,
+ can_delete_own_message_group: Json[GroupSettingChangeRequest] | None = None,
+ can_invite_users_group: Json[GroupSettingChangeRequest] | None = None,
+ can_manage_all_groups: Json[GroupSettingChangeRequest] | None = None,
+ can_manage_billing_group: Json[GroupSettingChangeRequest] | None = None,
+ can_mention_many_users_group: Json[GroupSettingChangeRequest] | None = None,
+ can_move_messages_between_channels_group: Json[GroupSettingChangeRequest] | None = None,
+ can_move_messages_between_topics_group: Json[GroupSettingChangeRequest] | None = None,
+ can_resolve_topics_group: Json[GroupSettingChangeRequest] | None = None,
+ can_set_topics_policy_group: Json[GroupSettingChangeRequest] | None = None,
+ can_summarize_topics_group: Json[GroupSettingChangeRequest] | None = None,
+ create_multiuse_invite_group: Json[GroupSettingChangeRequest] | None = None,
+ default_code_block_language: str | None = None,
+ default_language: str | None = None,
description: Annotated[
str | None, StringConstraints(max_length=Realm.MAX_REALM_DESCRIPTION_LENGTH)
] = None,
- emails_restricted_to_domains: Json[bool] | None = None,
+ digest_emails_enabled: Json[bool] | None = None,
+ digest_weekday: Json[DigestWeekdayEnum] | None = None,
+ direct_message_initiator_group: Json[GroupSettingChangeRequest] | None = None,
+ direct_message_permission_group: Json[GroupSettingChangeRequest] | None = None,
disallow_disposable_email_addresses: Json[bool] | None = None,
- invite_required: Json[bool] | None = None,
- create_multiuse_invite_group: Json[GroupSettingChangeRequest] | None = None,
- require_unique_names: Json[bool] | None = None,
- name_changes_disabled: Json[bool] | None = None,
email_changes_disabled: Json[bool] | None = None,
- avatar_changes_disabled: Json[bool] | None = None,
+ emails_restricted_to_domains: Json[bool] | None = None,
+ enable_guest_user_dm_warning: Json[bool] | None = None,
+ enable_guest_user_indicator: Json[bool] | None = None,
+ enable_read_receipts: Json[bool] | None = None,
+ enable_spectator_access: Json[bool] | None = None,
+ giphy_rating: Json[int] | None = None,
inline_image_preview: Json[bool] | None = None,
inline_url_embed_preview: Json[bool] | None = None,
- can_add_custom_emoji_group: Json[GroupSettingChangeRequest] | None = None,
- can_add_subscribers_group: Json[GroupSettingChangeRequest] | None = None,
- can_delete_any_message_group: Json[GroupSettingChangeRequest] | None = None,
- can_delete_own_message_group: Json[GroupSettingChangeRequest] | None = None,
+ invite_required: Json[bool] | None = None,
+ jitsi_server_url_raw: Annotated[
+ Json[str] | None,
+ AfterValidator(lambda val: check_jitsi_url(val)),
+ ApiParamConfig("jitsi_server_url"),
+ ] = None,
+ message_content_allowed_in_email_notifications: Json[bool] | None = None,
message_content_delete_limit_seconds_raw: Annotated[
Json[int | str] | None,
ApiParamConfig("message_content_delete_limit_seconds"),
] = None,
- allow_message_editing: Json[bool] | None = None,
- topics_policy: Annotated[
- str | None,
- AfterValidator(
- lambda val: parse_enum_from_string_value(
- val,
- "topics_policy",
- RealmTopicsPolicyEnum,
- )
- ),
- ] = None,
message_content_edit_limit_seconds_raw: Annotated[
Json[int | str] | None, ApiParamConfig("message_content_edit_limit_seconds")
] = None,
@@ -139,65 +160,44 @@ def update_realm(
)
),
] = None,
- default_language: str | None = None,
- waiting_period_threshold: Json[NonNegativeInt] | None = None,
- authentication_methods: Json[dict[str, Any]] | None = None,
- # Note: push_notifications_enabled and push_notifications_enabled_end_timestamp
- # are not offered here as it is maintained by the server, not via the API.
- moderation_request_channel_id: Json[int] | None = None,
- new_stream_announcements_stream_id: Json[int] | None = None,
- signup_announcements_stream_id: Json[int] | None = None,
- zulip_update_announcements_stream_id: Json[int] | None = None,
message_retention_days_raw: Annotated[
Json[int | str] | None, ApiParamConfig("message_retention_days")
] = None,
- send_welcome_emails: Json[bool] | None = None,
- digest_emails_enabled: Json[bool] | None = None,
- message_content_allowed_in_email_notifications: Json[bool] | None = None,
- can_create_bots_group: Json[GroupSettingChangeRequest] | None = None,
- can_create_groups: Json[GroupSettingChangeRequest] | None = None,
- can_create_public_channel_group: Json[GroupSettingChangeRequest] | None = None,
- can_create_private_channel_group: Json[GroupSettingChangeRequest] | None = None,
- can_create_web_public_channel_group: Json[GroupSettingChangeRequest] | None = None,
- can_create_write_only_bots_group: Json[GroupSettingChangeRequest] | None = None,
- can_invite_users_group: Json[GroupSettingChangeRequest] | None = None,
- can_manage_all_groups: Json[GroupSettingChangeRequest] | None = None,
- can_manage_billing_group: Json[GroupSettingChangeRequest] | None = None,
- can_mention_many_users_group: Json[GroupSettingChangeRequest] | None = None,
- can_move_messages_between_channels_group: Json[GroupSettingChangeRequest] | None = None,
- can_move_messages_between_topics_group: Json[GroupSettingChangeRequest] | None = None,
- can_resolve_topics_group: Json[GroupSettingChangeRequest] | None = None,
- can_set_topics_policy_group: Json[GroupSettingChangeRequest] | None = None,
- can_summarize_topics_group: Json[GroupSettingChangeRequest] | None = None,
- direct_message_initiator_group: Json[GroupSettingChangeRequest] | None = None,
- direct_message_permission_group: Json[GroupSettingChangeRequest] | None = None,
- video_chat_provider: Json[int] | None = None,
- jitsi_server_url_raw: Annotated[
- Json[str] | None,
- AfterValidator(lambda val: check_jitsi_url(val)),
- ApiParamConfig("jitsi_server_url"),
- ] = None,
- giphy_rating: Json[int] | None = None,
- default_code_block_language: str | None = None,
- digest_weekday: Json[DigestWeekdayEnum] | None = None,
- string_id: Annotated[
- str | None, StringConstraints(max_length=Realm.MAX_REALM_SUBDOMAIN_LENGTH)
+ moderation_request_channel_id: Json[int] | None = None,
+ move_messages_between_streams_limit_seconds_raw: Annotated[
+ Json[int | str] | None,
+ ApiParamConfig("move_messages_between_streams_limit_seconds"),
] = None,
- org_type: Json[OrgTypeEnum] | None = None,
- enable_spectator_access: Json[bool] | None = None,
- want_advertise_in_communities_directory: Json[bool] | None = None,
- enable_read_receipts: Json[bool] | None = None,
move_messages_within_stream_limit_seconds_raw: Annotated[
Json[int | str] | None,
ApiParamConfig("move_messages_within_stream_limit_seconds"),
] = None,
- move_messages_between_streams_limit_seconds_raw: Annotated[
- Json[int | str] | None,
- ApiParamConfig("move_messages_between_streams_limit_seconds"),
+ name: Annotated[str | None, StringConstraints(max_length=Realm.MAX_REALM_NAME_LENGTH)] = None,
+ name_changes_disabled: Json[bool] | None = None,
+ new_stream_announcements_stream_id: Json[int] | None = None,
+ org_type: Json[OrgTypeEnum] | None = None,
+ require_unique_names: Json[bool] | None = None,
+ send_welcome_emails: Json[bool] | None = None,
+ signup_announcements_stream_id: Json[int] | None = None,
+ string_id: Annotated[
+ str | None, StringConstraints(max_length=Realm.MAX_REALM_SUBDOMAIN_LENGTH)
] = None,
- enable_guest_user_dm_warning: Json[bool] | None = None,
- enable_guest_user_indicator: Json[bool] | None = None,
- can_access_all_users_group: Json[GroupSettingChangeRequest] | None = None,
+ topics_policy: Annotated[
+ str | None,
+ AfterValidator(
+ lambda val: parse_enum_from_string_value(
+ val,
+ "topics_policy",
+ RealmTopicsPolicyEnum,
+ )
+ ),
+ ] = None,
+ video_chat_provider: Json[int] | None = None,
+ waiting_period_threshold: Json[NonNegativeInt] | None = None,
+ want_advertise_in_communities_directory: Json[bool] | None = None,
+ zulip_update_announcements_stream_id: Json[int] | None = None,
+ # Note: push_notifications_enabled and push_notifications_enabled_end_timestamp
+ # are not offered here as it is maintained by the server, not via the API.
) -> HttpResponse:
# Realm object is being refetched here to make sure that we
# do not use stale object from cache which can happen when a
@@ -602,59 +602,54 @@ def update_realm_user_settings_defaults(
request: HttpRequest,
user_profile: UserProfile,
*,
- web_mark_read_on_scroll_policy: Json[
+ automatically_follow_topics_policy: Json[
Annotated[
int,
- check_int_in_validator(UserProfile.WEB_MARK_READ_ON_SCROLL_POLICY_CHOICES),
+ check_int_in_validator(UserProfile.AUTOMATICALLY_CHANGE_VISIBILITY_POLICY_CHOICES),
]
]
| None = None,
- web_channel_default_view: Json[
- Annotated[int, check_int_in_validator(UserProfile.WEB_CHANNEL_DEFAULT_VIEW_CHOICES)]
- ]
- | None = None,
- starred_message_counts: Json[bool] | None = None,
- receives_typing_notifications: Json[bool] | None = None,
- web_stream_unreads_count_display_policy: Json[
+ automatically_follow_topics_where_mentioned: Json[bool] | None = None,
+ automatically_unmute_topics_in_muted_streams_policy: Json[
Annotated[
int,
- check_int_in_validator(UserProfile.WEB_STREAM_UNREADS_COUNT_DISPLAY_POLICY_CHOICES),
+ check_int_in_validator(UserProfile.AUTOMATICALLY_CHANGE_VISIBILITY_POLICY_CHOICES),
]
]
| None = None,
- fluid_layout_width: Json[bool] | None = None,
- high_contrast_mode: Json[bool] | None = None,
color_scheme: Json[Annotated[int, check_int_in_validator(UserProfile.COLOR_SCHEME_CHOICES)]]
| None = None,
- web_font_size_px: Json[int] | None = None,
- web_line_height_percent: Json[int] | None = None,
- translate_emoticons: Json[bool] | None = None,
- display_emoji_reaction_users: Json[bool] | None = None,
- web_home_view: Literal["recent_topics", "inbox", "all_messages"] | None = None,
- web_escape_navigates_to_home_view: Json[bool] | None = None,
- left_side_userlist: Json[bool] | None = None,
- emojiset: Annotated[str, check_string_in_validator(emojiset_choices)] | None = None,
demote_inactive_streams: Json[
Annotated[int, check_int_in_validator(UserProfile.DEMOTE_STREAMS_CHOICES)]
]
| None = None,
- enable_stream_desktop_notifications: Json[bool] | None = None,
- enable_stream_email_notifications: Json[bool] | None = None,
- enable_stream_push_notifications: Json[bool] | None = None,
- enable_stream_audible_notifications: Json[bool] | None = None,
- wildcard_mentions_notify: Json[bool] | None = None,
+ desktop_icon_count_display: Json[
+ Annotated[int, check_int_in_validator(UserProfile.DESKTOP_ICON_COUNT_DISPLAY_CHOICES)]
+ ]
+ | None = None,
+ display_emoji_reaction_users: Json[bool] | None = None,
+ email_address_visibility: Json[
+ Annotated[int, check_int_in_validator(UserProfile.EMAIL_ADDRESS_VISIBILITY_TYPES)]
+ ]
+ | None = None,
+ email_notifications_batching_period_seconds: Json[int] | None = None,
+ emojiset: Annotated[str, check_string_in_validator(emojiset_choices)] | None = None,
+ enable_desktop_notifications: Json[bool] | None = None,
+ enable_digest_emails: Json[bool] | None = None,
+ enable_drafts_synchronization: Json[bool] | None = None,
+ enable_followed_topic_audible_notifications: Json[bool] | None = None,
enable_followed_topic_desktop_notifications: Json[bool] | None = None,
enable_followed_topic_email_notifications: Json[bool] | None = None,
enable_followed_topic_push_notifications: Json[bool] | None = None,
- enable_followed_topic_audible_notifications: Json[bool] | None = None,
enable_followed_topic_wildcard_mentions_notify: Json[bool] | None = None,
- notification_sound: str | None = None,
- enable_desktop_notifications: Json[bool] | None = None,
- enable_sounds: Json[bool] | None = None,
enable_offline_email_notifications: Json[bool] | None = None,
enable_offline_push_notifications: Json[bool] | None = None,
enable_online_push_notifications: Json[bool] | None = None,
- enable_digest_emails: Json[bool] | None = None,
+ enable_sounds: Json[bool] | None = None,
+ enable_stream_audible_notifications: Json[bool] | None = None,
+ enable_stream_desktop_notifications: Json[bool] | None = None,
+ enable_stream_email_notifications: Json[bool] | None = None,
+ enable_stream_push_notifications: Json[bool] | None = None,
# enable_login_emails is not included here, because we don't want
# security-related settings to be controlled by organization administrators.
# enable_marketing_emails is not included here, since we don't at
@@ -663,12 +658,15 @@ def update_realm_user_settings_defaults(
#
# We may want to change this model in the future, since some SSO signups
# do not offer an opportunity to prompt the user at all during signup.
+ enter_sends: Json[bool] | None = None,
+ fluid_layout_width: Json[bool] | None = None,
+ hide_ai_features: Json[bool] | None = None,
+ high_contrast_mode: Json[bool] | None = None,
+ left_side_userlist: Json[bool] | None = None,
message_content_in_email_notifications: Json[bool] | None = None,
+ notification_sound: str | None = None,
pm_content_in_desktop_notifications: Json[bool] | None = None,
- desktop_icon_count_display: Json[
- Annotated[int, check_int_in_validator(UserProfile.DESKTOP_ICON_COUNT_DISPLAY_CHOICES)]
- ]
- | None = None,
+ presence_enabled: Json[bool] | None = None,
realm_name_in_email_notifications_policy: Json[
Annotated[
int,
@@ -676,52 +674,54 @@ def update_realm_user_settings_defaults(
]
]
| None = None,
- automatically_follow_topics_policy: Json[
- Annotated[
- int,
- check_int_in_validator(UserProfile.AUTOMATICALLY_CHANGE_VISIBILITY_POLICY_CHOICES),
- ]
- ]
- | None = None,
- automatically_unmute_topics_in_muted_streams_policy: Json[
- Annotated[
- int,
- check_int_in_validator(UserProfile.AUTOMATICALLY_CHANGE_VISIBILITY_POLICY_CHOICES),
- ]
- ]
- | None = None,
- automatically_follow_topics_where_mentioned: Json[bool] | None = None,
- presence_enabled: Json[bool] | None = None,
- enter_sends: Json[bool] | None = None,
- enable_drafts_synchronization: Json[bool] | None = None,
- email_notifications_batching_period_seconds: Json[int] | None = None,
- twenty_four_hour_time: Json[bool] | None = None,
- send_stream_typing_notifications: Json[bool] | None = None,
+ receives_typing_notifications: Json[bool] | None = None,
+ resolved_topic_notice_auto_read_policy: Annotated[
+ str | None,
+ AfterValidator(
+ lambda val: parse_enum_from_string_value(
+ val,
+ "resolved_topic_notice_auto_read_policy",
+ ResolvedTopicNoticeAutoReadPolicyEnum,
+ )
+ ),
+ ] = None,
send_private_typing_notifications: Json[bool] | None = None,
send_read_receipts: Json[bool] | None = None,
+ send_stream_typing_notifications: Json[bool] | None = None,
+ starred_message_counts: Json[bool] | None = None,
+ translate_emoticons: Json[bool] | None = None,
+ twenty_four_hour_time: Json[bool] | None = None,
user_list_style: Json[
Annotated[int, check_int_in_validator(UserProfile.USER_LIST_STYLE_CHOICES)]
]
| None = None,
web_animate_image_previews: Literal["always", "on_hover", "never"] | None = None,
- email_address_visibility: Json[
- Annotated[int, check_int_in_validator(UserProfile.EMAIL_ADDRESS_VISIBILITY_TYPES)]
+ web_channel_default_view: Json[
+ Annotated[int, check_int_in_validator(UserProfile.WEB_CHANNEL_DEFAULT_VIEW_CHOICES)]
+ ]
+ | None = None,
+ web_escape_navigates_to_home_view: Json[bool] | None = None,
+ web_font_size_px: Json[int] | None = None,
+ web_home_view: Literal["recent_topics", "inbox", "all_messages"] | None = None,
+ web_left_sidebar_unreads_count_summary: Json[bool] | None = None,
+ web_line_height_percent: Json[int] | None = None,
+ web_mark_read_on_scroll_policy: Json[
+ Annotated[
+ int,
+ check_int_in_validator(UserProfile.WEB_MARK_READ_ON_SCROLL_POLICY_CHOICES),
+ ]
]
| None = None,
web_navigate_to_sent_message: Json[bool] | None = None,
+ web_stream_unreads_count_display_policy: Json[
+ Annotated[
+ int,
+ check_int_in_validator(UserProfile.WEB_STREAM_UNREADS_COUNT_DISPLAY_POLICY_CHOICES),
+ ]
+ ]
+ | None = None,
web_suggest_update_timezone: Json[bool] | None = None,
- web_left_sidebar_unreads_count_summary: Json[bool] | None = None,
- hide_ai_features: Json[bool] | None = None,
- resolved_topic_notice_auto_read_policy: Annotated[
- str | None,
- AfterValidator(
- lambda val: parse_enum_from_string_value(
- val,
- "resolved_topic_notice_auto_read_policy",
- ResolvedTopicNoticeAutoReadPolicyEnum,
- )
- ),
- ] = None,
+ wildcard_mentions_notify: Json[bool] | None = None,
) -> HttpResponse:
if notification_sound is not None or email_notifications_batching_period_seconds is not None:
check_settings_values(notification_sound, email_notifications_batching_period_seconds)
diff --git a/zerver/views/realm_domains.py b/zerver/views/realm_domains.py
index b7b0c9750da..efa73ac0a57 100644
--- a/zerver/views/realm_domains.py
+++ b/zerver/views/realm_domains.py
@@ -28,8 +28,8 @@ def create_realm_domain(
request: HttpRequest,
user_profile: UserProfile,
*,
- domain: str,
allow_subdomains: Json[bool],
+ domain: str,
) -> HttpResponse:
domain = domain.strip().lower()
try:
@@ -52,8 +52,8 @@ def patch_realm_domain(
request: HttpRequest,
user_profile: UserProfile,
*,
- domain: PathOnly[str],
allow_subdomains: Json[bool],
+ domain: PathOnly[str],
) -> HttpResponse:
try:
realm_domain = RealmDomain.objects.get(realm=user_profile.realm, domain=domain)
diff --git a/zerver/views/realm_playgrounds.py b/zerver/views/realm_playgrounds.py
index a9ae3bafb1e..7242d8f2a29 100644
--- a/zerver/views/realm_playgrounds.py
+++ b/zerver/views/realm_playgrounds.py
@@ -43,10 +43,10 @@ def add_realm_playground(
user_profile: UserProfile,
*,
name: str,
- url_template: str,
pygments_language: Annotated[
str, AfterValidator(lambda x: check_pygments_language("pygments_language", x))
],
+ url_template: str,
) -> HttpResponse:
playground_id = check_add_realm_playground(
realm=user_profile.realm,
diff --git a/zerver/views/registration.py b/zerver/views/registration.py
index 047574ab270..e69943d44d6 100644
--- a/zerver/views/registration.py
+++ b/zerver/views/registration.py
@@ -262,15 +262,15 @@ def import_realm_from_slack(*args: Any, **kwargs: Any) -> HttpResponse:
def registration_helper(
request: HttpRequest,
*,
- key: str = "",
- timezone: Annotated[str, timezone_or_empty_validator()] = "",
- from_confirmation: str | None = None,
+ cancel_import: Json[bool] = False,
form_full_name: Annotated[str | None, ApiParamConfig("full_name")] = None,
- source_realm_id: Annotated[NonNegativeInt | None, non_negative_int_or_none_validator()] = None,
form_is_demo_organization: Annotated[str | None, ApiParamConfig("is_demo_organization")] = None,
+ from_confirmation: str | None = None,
+ key: str = "",
slack_access_token: str | None = None,
+ source_realm_id: Annotated[NonNegativeInt | None, non_negative_int_or_none_validator()] = None,
start_slack_import: Json[bool] = False,
- cancel_import: Json[bool] = False,
+ timezone: Annotated[str, timezone_or_empty_validator()] = "",
) -> HttpResponse:
try:
prereg_object, realm_creation = check_prereg_key(request, key)
@@ -944,12 +944,12 @@ def prepare_activation_url(
email: str,
session: SessionBase,
*,
+ include_realm_default_subscriptions: bool | None = None,
+ invited_as: int | None = None,
+ multiuse_invite: MultiuseInvite | None = None,
realm: Realm | None,
streams: Iterable[Stream] | None = None,
user_groups: Iterable[NamedUserGroup] | None = None,
- invited_as: int | None = None,
- include_realm_default_subscriptions: bool | None = None,
- multiuse_invite: MultiuseInvite | None = None,
) -> str:
"""
Send an email with a confirmation link to the provided e-mail so the user
@@ -1388,9 +1388,9 @@ def new_realm_send_confirm(
request: HttpRequest,
*,
email: str,
+ realm_default_language: Annotated[str, StringConstraints(max_length=MAX_LANGUAGE_ID_LENGTH)],
realm_name: Annotated[str, StringConstraints(max_length=Realm.MAX_REALM_NAME_LENGTH)],
realm_type: Annotated[Json[int], check_int_in_validator(Realm.ORG_TYPE_IDS)],
- realm_default_language: Annotated[str, StringConstraints(max_length=MAX_LANGUAGE_ID_LENGTH)],
realm_subdomain: Annotated[str, StringConstraints(max_length=Realm.MAX_REALM_SUBDOMAIN_LENGTH)],
) -> HttpResponse:
return TemplateResponse(
diff --git a/zerver/views/saved_snippets.py b/zerver/views/saved_snippets.py
index 5c2288b1377..16639f8d1ca 100644
--- a/zerver/views/saved_snippets.py
+++ b/zerver/views/saved_snippets.py
@@ -27,16 +27,16 @@ def create_saved_snippet(
request: HttpRequest,
user_profile: UserProfile,
*,
- title: Annotated[
+ content: Annotated[
str,
StringConstraints(
- min_length=1, max_length=SavedSnippet.MAX_TITLE_LENGTH, strip_whitespace=True
+ min_length=1, max_length=settings.MAX_MESSAGE_LENGTH, strip_whitespace=True
),
],
- content: Annotated[
+ title: Annotated[
str,
StringConstraints(
- min_length=1, max_length=settings.MAX_MESSAGE_LENGTH, strip_whitespace=True
+ min_length=1, max_length=SavedSnippet.MAX_TITLE_LENGTH, strip_whitespace=True
),
],
) -> HttpResponse:
@@ -51,17 +51,17 @@ def edit_saved_snippet(
request: HttpRequest,
user_profile: UserProfile,
*,
- saved_snippet_id: PathOnly[int],
- title: Annotated[
+ content: Annotated[
str | None,
StringConstraints(
- min_length=1, max_length=SavedSnippet.MAX_TITLE_LENGTH, strip_whitespace=True
+ min_length=1, max_length=settings.MAX_MESSAGE_LENGTH, strip_whitespace=True
),
] = None,
- content: Annotated[
+ saved_snippet_id: PathOnly[int],
+ title: Annotated[
str | None,
StringConstraints(
- min_length=1, max_length=settings.MAX_MESSAGE_LENGTH, strip_whitespace=True
+ min_length=1, max_length=SavedSnippet.MAX_TITLE_LENGTH, strip_whitespace=True
),
] = None,
) -> HttpResponse:
diff --git a/zerver/views/scheduled_messages.py b/zerver/views/scheduled_messages.py
index 644565a2327..c27bec786e3 100644
--- a/zerver/views/scheduled_messages.py
+++ b/zerver/views/scheduled_messages.py
@@ -50,15 +50,15 @@ def update_scheduled_message_backend(
request: HttpRequest,
user_profile: UserProfile,
*,
- scheduled_message_id: PathOnly[NonNegativeInt],
+ message_content: Annotated[str | None, ApiParamConfig("content")] = None,
req_type: Annotated[
Annotated[str, check_string_in_validator(Message.API_RECIPIENT_TYPES)] | None,
ApiParamConfig("type"),
] = None,
+ scheduled_delivery_timestamp: Json[int] | None = None,
+ scheduled_message_id: PathOnly[NonNegativeInt],
to: Json[int | list[int]] | None = None,
topic_name: OptionalTopic = None,
- message_content: Annotated[str | None, ApiParamConfig("content")] = None,
- scheduled_delivery_timestamp: Json[int] | None = None,
) -> HttpResponse:
if (
req_type is None
@@ -127,15 +127,15 @@ def create_scheduled_message_backend(
request: HttpRequest,
user_profile: UserProfile,
*,
+ message_content: Annotated[str, ApiParamConfig("content")],
+ read_by_sender: Json[bool] | None = None,
+ req_to: Annotated[Json[int | list[int]], ApiParamConfig("to")],
req_type: Annotated[
Annotated[str, check_string_in_validator(Message.API_RECIPIENT_TYPES)],
ApiParamConfig("type"),
],
- req_to: Annotated[Json[int | list[int]], ApiParamConfig("to")],
- message_content: Annotated[str, ApiParamConfig("content")],
scheduled_delivery_timestamp: Json[int],
topic_name: OptionalTopic = None,
- read_by_sender: Json[bool] | None = None,
) -> HttpResponse:
recipient_type_name = req_type
if recipient_type_name == "direct":
diff --git a/zerver/views/streams.py b/zerver/views/streams.py
index a58fd3b60fb..b339d00ad6e 100644
--- a/zerver/views/streams.py
+++ b/zerver/views/streams.py
@@ -180,8 +180,8 @@ def create_default_stream_group(
request: HttpRequest,
user_profile: UserProfile,
*,
- group_name: str,
description: str,
+ group_name: str,
stream_names: Json[list[str]],
) -> HttpResponse:
streams = []
@@ -199,8 +199,8 @@ def update_default_stream_group_info(
user_profile: UserProfile,
*,
group_id: PathOnly[int],
- new_group_name: str | None = None,
new_description: str | None = None,
+ new_group_name: str | None = None,
) -> HttpResponse:
if not new_group_name and not new_description:
raise JsonableError(_('You must pass "new_description" or "new_group_name".'))
@@ -267,16 +267,24 @@ def update_stream_backend(
request: HttpRequest,
user_profile: UserProfile,
*,
- stream_id: PathOnly[int],
+ can_add_subscribers_group: Json[GroupSettingChangeRequest] | None = None,
+ can_administer_channel_group: Json[GroupSettingChangeRequest] | None = None,
+ can_move_messages_out_of_channel_group: Json[GroupSettingChangeRequest] | None = None,
+ can_move_messages_within_channel_group: Json[GroupSettingChangeRequest] | None = None,
+ can_remove_subscribers_group: Json[GroupSettingChangeRequest] | None = None,
+ can_send_message_group: Json[GroupSettingChangeRequest] | None = None,
+ can_subscribe_group: Json[GroupSettingChangeRequest] | None = None,
description: Annotated[str, StringConstraints(max_length=Stream.MAX_DESCRIPTION_LENGTH)]
| None = None,
- is_private: Json[bool] | None = None,
- is_default_stream: Json[bool] | None = None,
+ folder_id: Json[int | None] | MissingType = Missing,
history_public_to_subscribers: Json[bool] | None = None,
+ is_archived: Json[bool] | None = None,
+ is_default_stream: Json[bool] | None = None,
+ is_private: Json[bool] | None = None,
is_web_public: Json[bool] | None = None,
- new_name: str | None = None,
message_retention_days: Json[str] | Json[int] | None = None,
- is_archived: Json[bool] | None = None,
+ new_name: str | None = None,
+ stream_id: PathOnly[int],
topics_policy: Annotated[
str | None,
AfterValidator(
@@ -287,14 +295,6 @@ def update_stream_backend(
)
),
] = None,
- can_add_subscribers_group: Json[GroupSettingChangeRequest] | None = None,
- can_administer_channel_group: Json[GroupSettingChangeRequest] | None = None,
- can_move_messages_out_of_channel_group: Json[GroupSettingChangeRequest] | None = None,
- can_move_messages_within_channel_group: Json[GroupSettingChangeRequest] | None = None,
- can_send_message_group: Json[GroupSettingChangeRequest] | None = None,
- can_remove_subscribers_group: Json[GroupSettingChangeRequest] | None = None,
- can_subscribe_group: Json[GroupSettingChangeRequest] | None = None,
- folder_id: Json[int | None] | MissingType = Missing,
) -> HttpResponse:
# Most settings updates only require metadata access, not content
# access. We will check for content access further when and where
@@ -531,8 +531,8 @@ def update_subscriptions_backend(
request: HttpRequest,
user_profile: UserProfile,
*,
- delete: Json[list[str]] | None = None,
add: Json[list[AddSubscriptionData]] | None = None,
+ delete: Json[list[str]] | None = None,
) -> HttpResponse:
if delete is None:
delete = []
@@ -572,8 +572,8 @@ def remove_subscriptions_backend(
request: HttpRequest,
user_profile: UserProfile,
*,
- streams_raw: Annotated[Json[list[str]], ApiParamConfig("subscriptions")],
principals: Json[list[str] | list[int]] | None = None,
+ streams_raw: Annotated[Json[list[str]], ApiParamConfig("subscriptions")],
) -> HttpResponse:
realm = user_profile.realm
@@ -641,12 +641,24 @@ def add_subscriptions_backend(
request: HttpRequest,
user_profile: UserProfile,
*,
- streams_raw: Annotated[Json[list[AddSubscriptionData]], ApiParamConfig("subscriptions")],
+ announce: Json[bool] = False,
+ authorization_errors_fatal: Json[bool] = True,
+ can_add_subscribers_group: Json[int | UserGroupMembersData] | None = None,
+ can_administer_channel_group: Json[int | UserGroupMembersData] | None = None,
+ can_move_messages_out_of_channel_group: Json[int | UserGroupMembersData] | None = None,
+ can_move_messages_within_channel_group: Json[int | UserGroupMembersData] | None = None,
+ can_remove_subscribers_group: Json[int | UserGroupMembersData] | None = None,
+ can_send_message_group: Json[int | UserGroupMembersData] | None = None,
+ can_subscribe_group: Json[int | UserGroupMembersData] | None = None,
+ folder_id: Json[int] | None = None,
+ history_public_to_subscribers: Json[bool] | None = None,
invite_only: Json[bool] = False,
- is_web_public: Json[bool] = False,
is_default_stream: Json[bool] = False,
- history_public_to_subscribers: Json[bool] | None = None,
+ is_web_public: Json[bool] = False,
message_retention_days: Json[str] | Json[int] = RETENTION_DEFAULT,
+ principals: Json[list[str] | list[int]] | None = None,
+ send_new_subscription_messages: Json[bool] = True,
+ streams_raw: Annotated[Json[list[AddSubscriptionData]], ApiParamConfig("subscriptions")],
topics_policy: Json[
Annotated[
str | None,
@@ -659,18 +671,6 @@ def add_subscriptions_backend(
),
]
] = None,
- can_add_subscribers_group: Json[int | UserGroupMembersData] | None = None,
- can_administer_channel_group: Json[int | UserGroupMembersData] | None = None,
- can_move_messages_out_of_channel_group: Json[int | UserGroupMembersData] | None = None,
- can_move_messages_within_channel_group: Json[int | UserGroupMembersData] | None = None,
- can_send_message_group: Json[int | UserGroupMembersData] | None = None,
- can_remove_subscribers_group: Json[int | UserGroupMembersData] | None = None,
- can_subscribe_group: Json[int | UserGroupMembersData] | None = None,
- announce: Json[bool] = False,
- principals: Json[list[str] | list[int]] | None = None,
- authorization_errors_fatal: Json[bool] = True,
- folder_id: Json[int] | None = None,
- send_new_subscription_messages: Json[bool] = True,
) -> HttpResponse:
realm = user_profile.realm
stream_dicts = []
@@ -1032,15 +1032,15 @@ def get_streams_backend(
request: HttpRequest,
user_profile: UserProfile,
*,
- include_public: Json[bool] = True,
- include_web_public: Json[bool] = False,
- include_subscribed: Json[bool] = True,
exclude_archived: Json[bool] = True,
include_all: Json[bool] = False,
include_all_active: Json[bool] = False,
+ include_can_access_content: Json[bool] = False,
include_default: Json[bool] = False,
include_owner_subscribed: Json[bool] = False,
- include_can_access_content: Json[bool] = False,
+ include_public: Json[bool] = True,
+ include_subscribed: Json[bool] = True,
+ include_web_public: Json[bool] = False,
) -> HttpResponse:
if include_all_active is True:
include_all = True
@@ -1080,8 +1080,8 @@ def get_topics_backend(
request: HttpRequest,
maybe_user_profile: UserProfile | AnonymousUser,
*,
- stream_id: PathOnly[NonNegativeInt],
allow_empty_topic_name: Json[bool] = False,
+ stream_id: PathOnly[NonNegativeInt],
) -> HttpResponse:
if not maybe_user_profile.is_authenticated:
is_web_public_query = True
@@ -1236,8 +1236,8 @@ def update_subscriptions_property(
request: HttpRequest,
user_profile: UserProfile,
*,
- stream_id: PathOnly[Json[int]],
property: str,
+ stream_id: PathOnly[Json[int]],
value: Annotated[Json[bool] | str, Field(union_mode="left_to_right")],
) -> HttpResponse:
change_request = SubscriptionPropertyChangeRequest(
@@ -1289,8 +1289,8 @@ def get_stream_email_address(
request: HttpRequest,
user_profile: UserProfile,
*,
- stream_id: Annotated[NonNegativeInt, ApiParamConfig("stream", path_only=True)],
sender_id: Json[NonNegativeInt] | None = None,
+ stream_id: Annotated[NonNegativeInt, ApiParamConfig("stream", path_only=True)],
) -> HttpResponse:
(stream, sub) = access_stream_by_id(
user_profile,
diff --git a/zerver/views/submessage.py b/zerver/views/submessage.py
index aadea2788a8..14e1cfb5b03 100644
--- a/zerver/views/submessage.py
+++ b/zerver/views/submessage.py
@@ -22,9 +22,9 @@ def process_submessage(
request: HttpRequest,
user_profile: UserProfile,
*,
+ content: str,
message_id: Json[int],
msg_type: str,
- content: str,
) -> HttpResponse:
message = access_message(user_profile, message_id, lock_message=True, is_modifying_message=True)
diff --git a/zerver/views/thumbnail.py b/zerver/views/thumbnail.py
index 2d1a1ade169..bd6e930e4a3 100644
--- a/zerver/views/thumbnail.py
+++ b/zerver/views/thumbnail.py
@@ -13,8 +13,8 @@ def backend_serve_thumbnail(
request: HttpRequest,
maybe_user_profile: UserProfile | AnonymousUser,
*,
- url: str,
size: str,
+ url: str,
) -> HttpResponseBase:
# This URL used to be passed arbitrary URLs, and pass them through
# Camo; we no longer support doing so, and instead return a 403.
diff --git a/zerver/views/typing.py b/zerver/views/typing.py
index 3e333442c73..c8efdf0b194 100644
--- a/zerver/views/typing.py
+++ b/zerver/views/typing.py
@@ -29,9 +29,9 @@ def send_notification_backend(
request: HttpRequest,
user_profile: UserProfile,
*,
- req_type: Annotated[Literal["direct", "stream", "channel"], ApiParamConfig("type")] = "direct",
- operator: Annotated[Literal["start", "stop"], ApiParamConfig("op")],
notification_to: Annotated[Json[list[int] | None], ApiParamConfig("to")] = None,
+ operator: Annotated[Literal["start", "stop"], ApiParamConfig("op")],
+ req_type: Annotated[Literal["direct", "stream", "channel"], ApiParamConfig("type")] = "direct",
stream_id: Json[int | None] = None,
topic: OptionalTopic = None,
) -> HttpResponse:
diff --git a/zerver/views/user_groups.py b/zerver/views/user_groups.py
index a5d5c1aea95..5f409cb1b29 100644
--- a/zerver/views/user_groups.py
+++ b/zerver/views/user_groups.py
@@ -57,16 +57,16 @@ def add_user_group(
request: HttpRequest,
user_profile: UserProfile,
*,
- name: str,
- members: Json[list[int]],
- description: str,
- subgroups: Json[list[int]] | None = None,
can_add_members_group: Json[int | UserGroupMembersData] | None = None,
can_join_group: Json[int | UserGroupMembersData] | None = None,
can_leave_group: Json[int | UserGroupMembersData] | None = None,
can_manage_group: Json[int | UserGroupMembersData] | None = None,
can_mention_group: Json[int | UserGroupMembersData] | None = None,
can_remove_members_group: Json[int | UserGroupMembersData] | None = None,
+ description: str,
+ members: Json[list[int]],
+ name: str,
+ subgroups: Json[list[int]] | None = None,
) -> HttpResponse:
user_profile.realm.ensure_not_on_limited_plan()
user_profiles = user_ids_to_users(members, user_profile.realm, allow_deactivated=False)
@@ -131,9 +131,6 @@ def edit_user_group(
request: HttpRequest,
user_profile: UserProfile,
*,
- user_group_id: PathOnly[int],
- name: str | None = None,
- description: str | None = None,
can_add_members_group: Json[GroupSettingChangeRequest] | None = None,
can_join_group: Json[GroupSettingChangeRequest] | None = None,
can_leave_group: Json[GroupSettingChangeRequest] | None = None,
@@ -141,6 +138,9 @@ def edit_user_group(
can_mention_group: Json[GroupSettingChangeRequest] | None = None,
can_remove_members_group: Json[GroupSettingChangeRequest] | None = None,
deactivated: Json[bool] | None = None,
+ description: str | None = None,
+ name: str | None = None,
+ user_group_id: PathOnly[int],
) -> HttpResponse:
if (
name is None
@@ -230,11 +230,11 @@ def update_user_group_backend(
request: HttpRequest,
user_profile: UserProfile,
*,
- user_group_id: PathOnly[Json[int]],
- delete: Json[list[int]] | None = None,
add: Json[list[int]] | None = None,
- delete_subgroups: Json[list[int]] | None = None,
add_subgroups: Json[list[int]] | None = None,
+ delete: Json[list[int]] | None = None,
+ delete_subgroups: Json[list[int]] | None = None,
+ user_group_id: PathOnly[Json[int]],
) -> HttpResponse:
if not add and not delete and not add_subgroups and not delete_subgroups:
raise JsonableError(
@@ -503,9 +503,9 @@ def update_subgroups_of_user_group(
request: HttpRequest,
user_profile: UserProfile,
*,
- user_group_id: PathOnly[Json[int]],
- delete: Json[list[int]] | None = None,
add: Json[list[int]] | None = None,
+ delete: Json[list[int]] | None = None,
+ user_group_id: PathOnly[Json[int]],
) -> HttpResponse:
if not add and not delete:
raise JsonableError(_('Nothing to do. Specify at least one of "add" or "delete".'))
@@ -535,9 +535,9 @@ def get_is_user_group_member(
request: HttpRequest,
user_profile: UserProfile,
*,
+ direct_member_only: Json[bool] = False,
user_group_id: PathOnly[Json[int]],
user_id: PathOnly[Json[int]],
- direct_member_only: Json[bool] = False,
) -> HttpResponse:
user_group = access_user_group_to_read_membership(user_group_id, user_profile.realm)
target_user = access_user_by_id(user_profile, user_id, for_admin=False)
@@ -558,8 +558,8 @@ def get_user_group_members(
request: HttpRequest,
user_profile: UserProfile,
*,
- user_group_id: PathOnly[Json[int]],
direct_member_only: Json[bool] = False,
+ user_group_id: PathOnly[Json[int]],
) -> HttpResponse:
user_group = access_user_group_to_read_membership(user_group_id, user_profile.realm)
@@ -577,8 +577,8 @@ def get_subgroups_of_user_group(
request: HttpRequest,
user_profile: UserProfile,
*,
- user_group_id: PathOnly[Json[int]],
direct_subgroup_only: Json[bool] = False,
+ user_group_id: PathOnly[Json[int]],
) -> HttpResponse:
user_group = access_user_group_to_read_membership(user_group_id, user_profile.realm)
diff --git a/zerver/views/user_settings.py b/zerver/views/user_settings.py
index 00ef10138ad..b72fa81abf3 100644
--- a/zerver/views/user_settings.py
+++ b/zerver/views/user_settings.py
@@ -212,93 +212,90 @@ def json_change_settings(
request: HttpRequest,
user_profile: UserProfile,
*,
- full_name: str | None = None,
- email: str | None = None,
- old_password: str | None = None,
- new_password: str | None = None,
- twenty_four_hour_time: Json[bool] | None = None,
- web_mark_read_on_scroll_policy: Annotated[
- Json[int], check_int_in_validator(UserProfile.WEB_MARK_READ_ON_SCROLL_POLICY_CHOICES)
+ allow_private_data_export: Json[bool] | None = None,
+ automatically_follow_topics_policy: Annotated[
+ Json[int],
+ check_int_in_validator(UserProfile.AUTOMATICALLY_CHANGE_VISIBILITY_POLICY_CHOICES),
]
| None = None,
- web_channel_default_view: Annotated[
- Json[int], check_int_in_validator(UserProfile.WEB_CHANNEL_DEFAULT_VIEW_CHOICES)
+ automatically_follow_topics_where_mentioned: Json[bool] | None = None,
+ automatically_unmute_topics_in_muted_streams_policy: Annotated[
+ Json[int],
+ check_int_in_validator(UserProfile.AUTOMATICALLY_CHANGE_VISIBILITY_POLICY_CHOICES),
]
| None = None,
- starred_message_counts: Json[bool] | None = None,
- receives_typing_notifications: Json[bool] | None = None,
- fluid_layout_width: Json[bool] | None = None,
- high_contrast_mode: Json[bool] | None = None,
color_scheme: Annotated[Json[int], check_int_in_validator(UserProfile.COLOR_SCHEME_CHOICES)]
| None = None,
- web_font_size_px: Json[int] | None = None,
- web_line_height_percent: Json[int] | None = None,
- translate_emoticons: Json[bool] | None = None,
- display_emoji_reaction_users: Json[bool] | None = None,
default_language: str | None = None,
- web_home_view: Annotated[str, check_string_in_validator(web_home_view_options)] | None = None,
- web_escape_navigates_to_home_view: Json[bool] | None = None,
- left_side_userlist: Json[bool] | None = None,
- emojiset: Annotated[str, check_string_in_validator(emojiset_choices)] | None = None,
demote_inactive_streams: Annotated[
Json[int], check_int_in_validator(UserProfile.DEMOTE_STREAMS_CHOICES)
]
| None = None,
- web_stream_unreads_count_display_policy: Annotated[
- Json[int],
- check_int_in_validator(UserProfile.WEB_STREAM_UNREADS_COUNT_DISPLAY_POLICY_CHOICES),
+ desktop_icon_count_display: Annotated[
+ Json[int], check_int_in_validator(UserProfile.DESKTOP_ICON_COUNT_DISPLAY_CHOICES)
+ ]
+ | None = None,
+ display_emoji_reaction_users: Json[bool] | None = None,
+ email: str | None = None,
+ email_address_visibility: Annotated[
+ Json[int], check_int_in_validator(UserProfile.EMAIL_ADDRESS_VISIBILITY_TYPES)
]
| None = None,
- timezone: Annotated[str, timezone_validator()] | None = None,
email_notifications_batching_period_seconds: Json[int] | None = None,
+ emojiset: Annotated[str, check_string_in_validator(emojiset_choices)] | None = None,
+ enable_desktop_notifications: Json[bool] | None = None,
+ enable_digest_emails: Json[bool] | None = None,
enable_drafts_synchronization: Json[bool] | None = None,
- enable_stream_desktop_notifications: Json[bool] | None = None,
- enable_stream_email_notifications: Json[bool] | None = None,
- enable_stream_push_notifications: Json[bool] | None = None,
- enable_stream_audible_notifications: Json[bool] | None = None,
- wildcard_mentions_notify: Json[bool] | None = None,
+ enable_followed_topic_audible_notifications: Json[bool] | None = None,
enable_followed_topic_desktop_notifications: Json[bool] | None = None,
enable_followed_topic_email_notifications: Json[bool] | None = None,
enable_followed_topic_push_notifications: Json[bool] | None = None,
- enable_followed_topic_audible_notifications: Json[bool] | None = None,
enable_followed_topic_wildcard_mentions_notify: Json[bool] | None = None,
- notification_sound: str | None = None,
- enable_desktop_notifications: Json[bool] | None = None,
- enable_sounds: Json[bool] | None = None,
+ enable_login_emails: Json[bool] | None = None,
+ enable_marketing_emails: Json[bool] | None = None,
enable_offline_email_notifications: Json[bool] | None = None,
enable_offline_push_notifications: Json[bool] | None = None,
enable_online_push_notifications: Json[bool] | None = None,
- enable_digest_emails: Json[bool] | None = None,
- enable_login_emails: Json[bool] | None = None,
- enable_marketing_emails: Json[bool] | None = None,
+ enable_sounds: Json[bool] | None = None,
+ enable_stream_audible_notifications: Json[bool] | None = None,
+ enable_stream_desktop_notifications: Json[bool] | None = None,
+ enable_stream_email_notifications: Json[bool] | None = None,
+ enable_stream_push_notifications: Json[bool] | None = None,
+ enter_sends: Json[bool] | None = None,
+ fluid_layout_width: Json[bool] | None = None,
+ full_name: str | None = None,
+ high_contrast_mode: Json[bool] | None = None,
+ hide_ai_features: Json[bool] | None = None,
+ left_side_userlist: Json[bool] | None = None,
message_content_in_email_notifications: Json[bool] | None = None,
+ new_password: str | None = None,
+ notification_sound: str | None = None,
+ old_password: str | None = None,
pm_content_in_desktop_notifications: Json[bool] | None = None,
- desktop_icon_count_display: Annotated[
- Json[int], check_int_in_validator(UserProfile.DESKTOP_ICON_COUNT_DISPLAY_CHOICES)
- ]
- | None = None,
+ presence_enabled: Json[bool] | None = None,
realm_name_in_email_notifications_policy: Annotated[
Json[int],
check_int_in_validator(UserProfile.REALM_NAME_IN_EMAIL_NOTIFICATIONS_POLICY_CHOICES),
]
| None = None,
- automatically_follow_topics_policy: Annotated[
- Json[int],
- check_int_in_validator(UserProfile.AUTOMATICALLY_CHANGE_VISIBILITY_POLICY_CHOICES),
- ]
- | None = None,
- automatically_unmute_topics_in_muted_streams_policy: Annotated[
- Json[int],
- check_int_in_validator(UserProfile.AUTOMATICALLY_CHANGE_VISIBILITY_POLICY_CHOICES),
- ]
- | None = None,
- automatically_follow_topics_where_mentioned: Json[bool] | None = None,
- presence_enabled: Json[bool] | None = None,
- enter_sends: Json[bool] | None = None,
+ receives_typing_notifications: Json[bool] | None = None,
+ resolved_topic_notice_auto_read_policy: Annotated[
+ str | None,
+ AfterValidator(
+ lambda val: parse_enum_from_string_value(
+ val,
+ "resolved_topic_notice_auto_read_policy",
+ ResolvedTopicNoticeAutoReadPolicyEnum,
+ )
+ ),
+ ] = None,
send_private_typing_notifications: Json[bool] | None = None,
- send_stream_typing_notifications: Json[bool] | None = None,
send_read_receipts: Json[bool] | None = None,
- allow_private_data_export: Json[bool] | None = None,
+ send_stream_typing_notifications: Json[bool] | None = None,
+ starred_message_counts: Json[bool] | None = None,
+ timezone: Annotated[str, timezone_validator()] | None = None,
+ translate_emoticons: Json[bool] | None = None,
+ twenty_four_hour_time: Json[bool] | None = None,
user_list_style: Annotated[
Json[int], check_int_in_validator(UserProfile.USER_LIST_STYLE_CHOICES)
]
@@ -307,24 +304,27 @@ def json_change_settings(
str, check_string_in_validator(web_animate_image_previews_options)
]
| None = None,
- email_address_visibility: Annotated[
- Json[int], check_int_in_validator(UserProfile.EMAIL_ADDRESS_VISIBILITY_TYPES)
+ web_channel_default_view: Annotated[
+ Json[int], check_int_in_validator(UserProfile.WEB_CHANNEL_DEFAULT_VIEW_CHOICES)
+ ]
+ | None = None,
+ web_escape_navigates_to_home_view: Json[bool] | None = None,
+ web_font_size_px: Json[int] | None = None,
+ web_home_view: Annotated[str, check_string_in_validator(web_home_view_options)] | None = None,
+ web_left_sidebar_unreads_count_summary: Json[bool] | None = None,
+ web_line_height_percent: Json[int] | None = None,
+ web_mark_read_on_scroll_policy: Annotated[
+ Json[int], check_int_in_validator(UserProfile.WEB_MARK_READ_ON_SCROLL_POLICY_CHOICES)
]
| None = None,
web_navigate_to_sent_message: Json[bool] | None = None,
+ web_stream_unreads_count_display_policy: Annotated[
+ Json[int],
+ check_int_in_validator(UserProfile.WEB_STREAM_UNREADS_COUNT_DISPLAY_POLICY_CHOICES),
+ ]
+ | None = None,
web_suggest_update_timezone: Json[bool] | None = None,
- web_left_sidebar_unreads_count_summary: Json[bool] | None = None,
- hide_ai_features: Json[bool] | None = None,
- resolved_topic_notice_auto_read_policy: Annotated[
- str | None,
- AfterValidator(
- lambda val: parse_enum_from_string_value(
- val,
- "resolved_topic_notice_auto_read_policy",
- ResolvedTopicNoticeAutoReadPolicyEnum,
- )
- ),
- ] = None,
+ wildcard_mentions_notify: Json[bool] | None = None,
) -> HttpResponse:
# UserProfile object is being refetched here to make sure that we
# do not use stale object from cache which can happen when a
diff --git a/zerver/views/user_topics.py b/zerver/views/user_topics.py
index 6045862a1bc..91efe73e5a8 100644
--- a/zerver/views/user_topics.py
+++ b/zerver/views/user_topics.py
@@ -67,10 +67,10 @@ def update_muted_topic(
request: HttpRequest,
user_profile: UserProfile,
*,
- stream_id: Json[int] | None = None,
- stream: str | None = None,
- topic: Annotated[str, StringConstraints(max_length=MAX_TOPIC_NAME_LENGTH)],
op: Literal["add", "remove"],
+ topic: Annotated[str, StringConstraints(max_length=MAX_TOPIC_NAME_LENGTH)],
+ stream: str | None = None,
+ stream_id: Json[int] | None = None,
) -> HttpResponse:
check_for_exactly_one_stream_arg(stream_id=stream_id, stream=stream)
diff --git a/zerver/views/users.py b/zerver/views/users.py
index f02d908597f..f8b1efd4cd3 100644
--- a/zerver/views/users.py
+++ b/zerver/views/users.py
@@ -119,9 +119,9 @@ def deactivate_user_backend(
request: HttpRequest,
user_profile: UserProfile,
*,
- user_id: PathOnly[int],
deactivation_notification_comment: Annotated[str, StringConstraints(max_length=2000)]
| None = None,
+ user_id: PathOnly[int],
) -> HttpResponse:
target = access_user_by_id(user_profile, user_id, for_admin=True)
if target.is_realm_owner and not user_profile.is_realm_owner:
@@ -207,11 +207,11 @@ def update_user_by_id_api(
request: HttpRequest,
user_profile: UserProfile,
*,
- user_id: PathOnly[int],
full_name: str | None = None,
- role: Json[RoleParamType] | None = None,
- profile_data: Json[list[ProfileDataElement]] | None = None,
new_email: str | None = None,
+ profile_data: Json[list[ProfileDataElement]] | None = None,
+ role: Json[RoleParamType] | None = None,
+ user_id: PathOnly[int],
) -> HttpResponse:
target = access_user_by_id(
user_profile, user_id, allow_deactivated=True, allow_bots=True, for_admin=True
@@ -235,9 +235,9 @@ def update_user_by_email_api(
*,
email: PathOnly[str],
full_name: str | None = None,
- role: Json[RoleParamType] | None = None,
- profile_data: Json[list[ProfileDataElement]] | None = None,
new_email: str | None = None,
+ profile_data: Json[list[ProfileDataElement]] | None = None,
+ role: Json[RoleParamType] | None = None,
) -> HttpResponse:
target = access_user_by_email(
user_profile, email, allow_deactivated=True, allow_bots=True, for_admin=True
@@ -259,9 +259,9 @@ def update_user_backend(
target: UserProfile,
*,
full_name: str | None = None,
- role: Json[RoleParamType] | None = None,
- profile_data: Json[list[ProfileDataElement]] | None = None,
new_email: str | None = None,
+ profile_data: Json[list[ProfileDataElement]] | None = None,
+ role: Json[RoleParamType] | None = None,
) -> HttpResponse:
if new_email is not None and (
not user_profile.can_change_user_emails or not user_profile.is_realm_admin
@@ -441,15 +441,15 @@ def patch_bot_backend(
user_profile: UserProfile,
*,
bot_id: PathOnly[int],
- full_name: str | None = None,
- role: Json[RoleParamType] | None = None,
bot_owner_id: Json[int] | None = None,
config_data: Json[dict[str, str]] | None = None,
- service_payload_url: Json[Annotated[str, AfterValidator(check_url)]] | None = None,
- service_interface: Json[int] = 1,
- default_sending_stream: str | None = None,
- default_events_register_stream: str | None = None,
default_all_public_streams: Json[bool] | None = None,
+ default_events_register_stream: str | None = None,
+ default_sending_stream: str | None = None,
+ full_name: str | None = None,
+ role: Json[RoleParamType] | None = None,
+ service_interface: Json[int] = 1,
+ service_payload_url: Json[Annotated[str, AfterValidator(check_url)]] | None = None,
) -> HttpResponse:
bot = access_bot_by_id(user_profile, bot_id)
@@ -555,20 +555,20 @@ def add_bot_backend(
request: HttpRequest,
user_profile: UserProfile,
*,
- full_name_raw: Annotated[str, ApiParamConfig("full_name")],
- short_name_raw: Annotated[str, ApiParamConfig("short_name")],
bot_type: Json[int] = UserProfile.DEFAULT_BOT,
- payload_url: Json[Annotated[str, AfterValidator(check_url)]] = "",
- service_name: str | None = None,
config_data: Json[Mapping[str, str]] | None = None,
- interface_type: Json[int] = Service.GENERIC,
- default_sending_stream_name: Annotated[
- str | None, ApiParamConfig("default_sending_stream")
- ] = None,
+ default_all_public_streams: Json[bool] | None = None,
default_events_register_stream_name: Annotated[
str | None, ApiParamConfig("default_events_register_stream")
] = None,
- default_all_public_streams: Json[bool] | None = None,
+ default_sending_stream_name: Annotated[
+ str | None, ApiParamConfig("default_sending_stream")
+ ] = None,
+ full_name_raw: Annotated[str, ApiParamConfig("full_name")],
+ interface_type: Json[int] = Service.GENERIC,
+ payload_url: Json[Annotated[str, AfterValidator(check_url)]] = "",
+ service_name: str | None = None,
+ short_name_raw: Annotated[str, ApiParamConfig("short_name")],
) -> HttpResponse:
if config_data is None:
config_data = {}
@@ -727,9 +727,9 @@ def get_user_data(
include_custom_profile_fields: bool,
client_gravatar: bool,
*,
+ realm: Realm | None = None,
target_user: UserProfile | None = None,
user_ids: list[int] | None = None,
- realm: Realm | None = None,
) -> dict[str, Any]:
"""
The client_gravatar field here is set to True by default assuming that clients
@@ -766,8 +766,8 @@ def get_member_backend(
user_profile: UserProfile,
user_id: int,
*,
- include_custom_profile_fields: Json[bool] = False,
client_gravatar: Json[bool] = True,
+ include_custom_profile_fields: Json[bool] = False,
) -> HttpResponse:
target_user = access_user_by_id(
user_profile, user_id, allow_deactivated=True, allow_bots=True, for_admin=False
@@ -786,9 +786,9 @@ def get_members_backend(
request: HttpRequest,
maybe_user_profile: UserProfile | AnonymousUser,
*,
- user_ids: Json[list[int]] | None = None,
- include_custom_profile_fields: Json[bool] = False,
client_gravatar: Json[bool] = True,
+ include_custom_profile_fields: Json[bool] = False,
+ user_ids: Json[list[int]] | None = None,
) -> HttpResponse:
if isinstance(maybe_user_profile, UserProfile):
user_profile = maybe_user_profile
@@ -893,8 +893,8 @@ def get_subscription_backend(
request: HttpRequest,
user_profile: UserProfile,
*,
- user_id: PathOnly[Json[int]],
stream_id: PathOnly[Json[int]],
+ user_id: PathOnly[Json[int]],
) -> HttpResponse:
target_user = access_user_by_id(user_profile, user_id, for_admin=False)
(stream, sub) = access_stream_by_id(user_profile, stream_id, require_content_access=False)
@@ -909,9 +909,9 @@ def get_user_by_email(
request: HttpRequest,
user_profile: UserProfile,
*,
+ client_gravatar: Json[bool] = True,
email: PathOnly[str],
include_custom_profile_fields: Json[bool] = False,
- client_gravatar: Json[bool] = True,
) -> HttpResponse:
target_user = access_user_by_email(
user_profile, email, allow_deactivated=True, allow_bots=True, for_admin=False