diff --git a/analytics/urls.py b/analytics/urls.py index fd62887f2a..eff877f06a 100644 --- a/analytics/urls.py +++ b/analytics/urls.py @@ -1,27 +1,42 @@ from django.conf.urls import include from django.urls import path -import analytics.views +from analytics.views import ( + get_activity, + get_chart_data, + get_chart_data_for_installation, + get_chart_data_for_realm, + get_chart_data_for_remote_installation, + get_chart_data_for_remote_realm, + get_realm_activity, + get_user_activity, + stats, + stats_for_installation, + stats_for_realm, + stats_for_remote_installation, + stats_for_remote_realm, + support, +) from zerver.lib.rest import rest_dispatch i18n_urlpatterns = [ # Server admin (user_profile.is_staff) visible stats pages - path('activity', analytics.views.get_activity), - path('activity/support', analytics.views.support, + path('activity', get_activity), + path('activity/support', support, name='support'), - path('realm_activity//', analytics.views.get_realm_activity), - path('user_activity//', analytics.views.get_user_activity), + path('realm_activity//', get_realm_activity), + path('user_activity//', get_user_activity), - path('stats/realm//', analytics.views.stats_for_realm), - path('stats/installation', analytics.views.stats_for_installation), + path('stats/realm//', stats_for_realm), + path('stats/installation', stats_for_installation), path('stats/remote//installation', - analytics.views.stats_for_remote_installation), + stats_for_remote_installation), path('stats/remote//realm//', - analytics.views.stats_for_remote_realm), + stats_for_remote_realm), # User-visible stats page - path('stats', analytics.views.stats, - name='analytics.views.stats'), + path('stats', stats, + name='stats'), ] # These endpoints are a part of the API (V1), which uses: @@ -35,16 +50,16 @@ i18n_urlpatterns = [ v1_api_and_json_patterns = [ # get data for the graphs at /stats path('analytics/chart_data', rest_dispatch, - {'GET': analytics.views.get_chart_data}), + {'GET': get_chart_data}), path('analytics/chart_data/realm/', rest_dispatch, - {'GET': analytics.views.get_chart_data_for_realm}), + {'GET': get_chart_data_for_realm}), path('analytics/chart_data/installation', rest_dispatch, - {'GET': analytics.views.get_chart_data_for_installation}), + {'GET': get_chart_data_for_installation}), path('analytics/chart_data/remote//installation', rest_dispatch, - {'GET': analytics.views.get_chart_data_for_remote_installation}), + {'GET': get_chart_data_for_remote_installation}), path('analytics/chart_data/remote//realm/', rest_dispatch, - {'GET': analytics.views.get_chart_data_for_remote_realm}), + {'GET': get_chart_data_for_remote_realm}), ] i18n_urlpatterns += [ diff --git a/corporate/urls.py b/corporate/urls.py index 69df9bba56..8262fc597f 100644 --- a/corporate/urls.py +++ b/corporate/urls.py @@ -4,7 +4,14 @@ from django.conf.urls import include from django.urls import path from django.views.generic import TemplateView -import corporate.views +from corporate.views import ( + billing_home, + change_plan_status, + initial_upgrade, + replace_payment_source, + sponsorship, + upgrade, +) from zerver.lib.rest import rest_dispatch i18n_urlpatterns: Any = [ @@ -15,19 +22,19 @@ i18n_urlpatterns: Any = [ path('jobs/', TemplateView.as_view(template_name='corporate/jobs.html')), # Billing - path('billing/', corporate.views.billing_home), - path('upgrade/', corporate.views.initial_upgrade, name='initial_upgrade'), + path('billing/', billing_home), + path('upgrade/', initial_upgrade, name='initial_upgrade'), ] v1_api_and_json_patterns = [ path('billing/upgrade', rest_dispatch, - {'POST': corporate.views.upgrade}), + {'POST': upgrade}), path('billing/sponsorship', rest_dispatch, - {'POST': corporate.views.sponsorship}), + {'POST': sponsorship}), path('billing/plan/change', rest_dispatch, - {'POST': corporate.views.change_plan_status}), + {'POST': change_plan_status}), path('billing/sources/change', rest_dispatch, - {'POST': corporate.views.replace_payment_source}), + {'POST': replace_payment_source}), ] # Make a copy of i18n_urlpatterns so that they appear without prefix for English diff --git a/docs/tutorials/life-of-a-request.md b/docs/tutorials/life-of-a-request.md index 8f278ba5f8..b73eecb65d 100644 --- a/docs/tutorials/life-of-a-request.md +++ b/docs/tutorials/life-of-a-request.md @@ -140,9 +140,9 @@ yields a response with this HTTP header: We can see this reflected in [zproject/urls.py](https://github.com/zulip/zulip/blob/master/zproject/urls.py): - path('users', zerver.lib.rest.rest_dispatch, - {'GET': zerver.views.users.get_members_backend, - 'PUT': zerver.views.users.create_user_backend}), + path('users', rest_dispatch, + {'GET': get_members_backend, + 'PUT': create_user_backend}), In this way, the API is partially self-documenting. @@ -176,8 +176,8 @@ the request, and then figure out which view to show from that. In our example, ``` -{'GET': zerver.views.users.get_members_backend, - 'PUT': zerver.views.users.create_user_backend} +{'GET': get_members_backend, + 'PUT': create_user_backend} ``` is supplied as an argument to `rest_dispatch`, along with the diff --git a/zilencer/urls.py b/zilencer/urls.py index 5a89b56d5e..cfc6b20ba3 100644 --- a/zilencer/urls.py +++ b/zilencer/urls.py @@ -3,30 +3,38 @@ from typing import Any from django.conf.urls import include from django.urls import path -import zilencer.views from zerver.lib.rest import rest_dispatch +from zilencer.views import ( + register_remote_push_device, + register_remote_server, + remote_server_check_analytics, + remote_server_notify_push, + remote_server_post_analytics, + unregister_all_remote_push_devices, + unregister_remote_push_device, +) i18n_urlpatterns: Any = [] # Zilencer views following the REST API style v1_api_and_json_patterns = [ path('remotes/push/register', rest_dispatch, - {'POST': zilencer.views.register_remote_push_device}), + {'POST': register_remote_push_device}), path('remotes/push/unregister', rest_dispatch, - {'POST': zilencer.views.unregister_remote_push_device}), + {'POST': unregister_remote_push_device}), path('remotes/push/unregister/all', rest_dispatch, - {'POST': zilencer.views.unregister_all_remote_push_devices}), + {'POST': unregister_all_remote_push_devices}), path('remotes/push/notify', rest_dispatch, - {'POST': zilencer.views.remote_server_notify_push}), + {'POST': remote_server_notify_push}), # Push signup doesn't use the REST API, since there's no auth. - path('remotes/server/register', zilencer.views.register_remote_server), + path('remotes/server/register', register_remote_server), # For receiving table data used in analytics and billing path('remotes/server/analytics', rest_dispatch, - {'POST': zilencer.views.remote_server_post_analytics}), + {'POST': remote_server_post_analytics}), path('remotes/server/analytics/status', rest_dispatch, - {'GET': zilencer.views.remote_server_check_analytics}), + {'GET': remote_server_check_analytics}), ] urlpatterns = [ diff --git a/zproject/dev_urls.py b/zproject/dev_urls.py index 3c67e817c0..33242a2789 100644 --- a/zproject/dev_urls.py +++ b/zproject/dev_urls.py @@ -9,10 +9,19 @@ from django.urls import path from django.views.generic import TemplateView from django.views.static import serve -import zerver.views.auth -import zerver.views.development.email_log -import zerver.views.development.integrations -import zerver.views.development.registration +from zerver.views.auth import login_page +from zerver.views.development.email_log import clear_emails, email_page, generate_all_emails +from zerver.views.development.integrations import ( + check_send_webhook_fixture_message, + dev_panel, + get_fixtures, + send_all_webhook_fixture_messages, +) +from zerver.views.development.registration import ( + confirmation_key, + register_development_realm, + register_development_user, +) # These URLs are available only in the development environment @@ -33,22 +42,22 @@ urls = [ os.path.join(settings.DEPLOY_ROOT, 'docs/_build/html')}), # The special no-password login endpoint for development - path('devlogin/', zerver.views.auth.login_page, + path('devlogin/', login_page, {'template_name': 'zerver/dev_login.html'}, name='login_page'), # Page for testing email templates - path('emails/', zerver.views.development.email_log.email_page), - path('emails/generate/', zerver.views.development.email_log.generate_all_emails), - path('emails/clear/', zerver.views.development.email_log.clear_emails), + path('emails/', email_page), + path('emails/generate/', generate_all_emails), + path('emails/clear/', clear_emails), # Listing of useful URLs and various tools for development path('devtools/', TemplateView.as_view(template_name='zerver/dev_tools.html')), # Register New User and Realm path('devtools/register_user/', - zerver.views.development.registration.register_development_user, + register_development_user, name='register_dev_user'), path('devtools/register_realm/', - zerver.views.development.registration.register_development_realm, + register_development_realm, name='register_dev_realm'), # Have easy access for error pages @@ -56,13 +65,13 @@ urls = [ path('errors/5xx/', TemplateView.as_view(template_name='500.html')), # Add a convenient way to generate webhook messages from fixtures. - path('devtools/integrations/', zerver.views.development.integrations.dev_panel), + path('devtools/integrations/', dev_panel), path('devtools/integrations/check_send_webhook_fixture_message', - zerver.views.development.integrations.check_send_webhook_fixture_message), + check_send_webhook_fixture_message), path('devtools/integrations/send_all_webhook_fixture_messages', - zerver.views.development.integrations.send_all_webhook_fixture_messages), + send_all_webhook_fixture_messages), path('devtools/integrations//fixtures', - zerver.views.development.integrations.get_fixtures), + get_fixtures), ] # Serve static assets via the Django server @@ -79,7 +88,7 @@ else: urls += static(urlsplit(settings.STATIC_URL).path, view=serve_static) i18n_urls = [ - path('confirmation_key/', zerver.views.development.registration.confirmation_key), + path('confirmation_key/', confirmation_key), ] urls += i18n_urls diff --git a/zproject/urls.py b/zproject/urls.py index f67a713a80..d80d2fa1ce 100644 --- a/zproject/urls.py +++ b/zproject/urls.py @@ -13,57 +13,206 @@ from django.urls import path from django.utils.module_loading import import_string from django.views.generic import RedirectView, TemplateView -import zerver.forms -import zerver.tornado.views -import zerver.views.alert_words -import zerver.views.archive -import zerver.views.attachments -import zerver.views.auth -import zerver.views.camo -import zerver.views.compatibility -import zerver.views.custom_profile_fields -import zerver.views.digest -import zerver.views.documentation -import zerver.views.drafts -import zerver.views.email_mirror -import zerver.views.events_register -import zerver.views.home -import zerver.views.hotspots -import zerver.views.invite -import zerver.views.message_edit -import zerver.views.message_fetch -import zerver.views.message_flags -import zerver.views.message_send -import zerver.views.muting -import zerver.views.portico -import zerver.views.presence -import zerver.views.push_notifications -import zerver.views.reactions -import zerver.views.realm -import zerver.views.realm_domains -import zerver.views.realm_emoji -import zerver.views.realm_export -import zerver.views.realm_filters -import zerver.views.realm_icon -import zerver.views.realm_logo -import zerver.views.registration -import zerver.views.report -import zerver.views.storage -import zerver.views.streams -import zerver.views.submessage -import zerver.views.thumbnail -import zerver.views.tutorial -import zerver.views.typing -import zerver.views.unsubscribe -import zerver.views.upload -import zerver.views.user_groups -import zerver.views.user_settings -import zerver.views.users -import zerver.views.video_calls -import zerver.views.zephyr +from zerver.forms import LoggingSetPasswordForm from zerver.lib.integrations import WEBHOOK_INTEGRATIONS from zerver.lib.rest import rest_dispatch -from zerver.views.documentation import IntegrationView, MarkdownDirectoryView +from zerver.tornado.views import cleanup_event_queue, get_events, get_events_internal, notify +from zerver.views.alert_words import add_alert_words, list_alert_words, remove_alert_words +from zerver.views.archive import archive, get_web_public_topics_backend +from zerver.views.attachments import list_by_user, remove +from zerver.views.auth import ( + api_dev_fetch_api_key, + api_dev_list_users, + api_fetch_api_key, + api_fetch_google_client_id, + api_get_server_settings, + config_error_view, + dev_direct_login, + json_fetch_api_key, + log_into_subdomain, + login_page, + logout_then_login, + password_reset, + remote_user_jwt, + remote_user_sso, + saml_sp_metadata, + show_deactivation_notice, + start_remote_user_sso, + start_social_login, + start_social_signup, +) +from zerver.views.camo import handle_camo_url +from zerver.views.compatibility import check_global_compatibility +from zerver.views.custom_profile_fields import ( + create_realm_custom_profile_field, + delete_realm_custom_profile_field, + list_realm_custom_profile_fields, + remove_user_custom_profile_data, + reorder_realm_custom_profile_fields, + update_realm_custom_profile_field, + update_user_custom_profile_data, +) +from zerver.views.digest import digest_page +from zerver.views.documentation import IntegrationView, MarkdownDirectoryView, integration_doc +from zerver.views.drafts import create_drafts, delete_draft, edit_draft, fetch_drafts +from zerver.views.email_mirror import email_mirror_message +from zerver.views.events_register import events_register_backend +from zerver.views.home import accounts_accept_terms, desktop_home, home +from zerver.views.hotspots import mark_hotspot_as_read +from zerver.views.invite import ( + generate_multiuse_invite_backend, + get_user_invites, + invite_users_backend, + resend_user_invite_email, + revoke_multiuse_invite, + revoke_user_invite, +) +from zerver.views.message_edit import ( + delete_message_backend, + get_message_edit_history, + json_fetch_raw_message, + update_message_backend, +) +from zerver.views.message_fetch import get_messages_backend, messages_in_narrow_backend +from zerver.views.message_flags import ( + mark_all_as_read, + mark_stream_as_read, + mark_topic_as_read, + update_message_flags, +) +from zerver.views.message_send import render_message_backend, send_message_backend, zcommand_backend +from zerver.views.muting import update_muted_topic +from zerver.views.portico import ( + apps_view, + hello_view, + landing_view, + plans_view, + privacy_view, + team_view, + terms_view, +) +from zerver.views.presence import ( + get_presence_backend, + get_statuses_for_realm, + update_active_status_backend, + update_user_status_backend, +) +from zerver.views.push_notifications import ( + add_android_reg_id, + add_apns_device_token, + remove_android_reg_id, + remove_apns_device_token, +) +from zerver.views.reactions import add_reaction, remove_reaction +from zerver.views.realm import ( + check_subdomain_available, + deactivate_realm, + realm_reactivation, + update_realm, +) +from zerver.views.realm_domains import ( + create_realm_domain, + delete_realm_domain, + list_realm_domains, + patch_realm_domain, +) +from zerver.views.realm_emoji import delete_emoji, list_emoji, upload_emoji +from zerver.views.realm_export import delete_realm_export, export_realm, get_realm_exports +from zerver.views.realm_filters import create_filter, delete_filter, list_filters +from zerver.views.realm_icon import delete_icon_backend, get_icon_backend, upload_icon +from zerver.views.realm_logo import delete_logo_backend, get_logo_backend, upload_logo +from zerver.views.registration import ( + accounts_home, + accounts_home_from_multiuse_invite, + accounts_register, + check_prereg_key_and_redirect, + create_realm, + find_account, + generate_204, + realm_redirect, +) +from zerver.views.report import ( + report_csp_violations, + report_error, + report_narrow_times, + report_send_times, + report_unnarrow_times, +) +from zerver.views.storage import get_storage, remove_storage, update_storage +from zerver.views.streams import ( + add_default_stream, + add_subscriptions_backend, + create_default_stream_group, + deactivate_stream_backend, + delete_in_topic, + get_streams_backend, + get_subscribers_backend, + get_topics_backend, + json_get_stream_id, + list_subscriptions_backend, + remove_default_stream, + remove_default_stream_group, + remove_subscriptions_backend, + update_default_stream_group_info, + update_default_stream_group_streams, + update_stream_backend, + update_subscription_properties_backend, + update_subscriptions_backend, + update_subscriptions_property, +) +from zerver.views.submessage import process_submessage +from zerver.views.thumbnail import backend_serve_thumbnail +from zerver.views.tutorial import set_tutorial_status +from zerver.views.typing import send_notification_backend +from zerver.views.unsubscribe import email_unsubscribe +from zerver.views.upload import ( + serve_file_backend, + serve_file_url_backend, + serve_local_file_unauthed, + upload_file_backend, +) +from zerver.views.user_groups import ( + add_user_group, + delete_user_group, + edit_user_group, + get_user_group, + update_user_group_backend, +) +from zerver.views.user_settings import ( + change_enter_sends, + confirm_email_change, + delete_avatar_backend, + json_change_notify_settings, + json_change_settings, + regenerate_api_key, + set_avatar_backend, + update_display_settings_backend, +) +from zerver.views.users import ( + add_bot_backend, + avatar, + create_user_backend, + deactivate_bot_backend, + deactivate_user_backend, + deactivate_user_own_backend, + get_bots_backend, + get_members_backend, + get_profile_backend, + get_subscription_backend, + patch_bot_backend, + reactivate_user_backend, + regenerate_bot_api_key, + update_user_backend, +) +from zerver.views.video_calls import ( + complete_zoom_user, + deauthorize_zoom_user, + get_bigbluebutton_url, + join_bigbluebutton, + make_zoom_video_call, + register_zoom_user, +) +from zerver.views.zephyr import webathena_kerberos_login from zproject import dev_urls from zproject.legacy_urls import legacy_urls @@ -97,153 +246,153 @@ if settings.TWO_FACTOR_AUTHENTICATION_ENABLED: v1_api_and_json_patterns = [ # realm-level calls path('realm', rest_dispatch, - {'PATCH': zerver.views.realm.update_realm}), + {'PATCH': update_realm}), # Returns a 204, used by desktop app to verify connectivity status - path('generate_204', zerver.views.registration.generate_204), + path('generate_204', generate_204), - path('realm/subdomain/', zerver.views.realm.check_subdomain_available), + path('realm/subdomain/', check_subdomain_available), # realm/domains -> zerver.views.realm_domains path('realm/domains', rest_dispatch, - {'GET': zerver.views.realm_domains.list_realm_domains, - 'POST': zerver.views.realm_domains.create_realm_domain}), + {'GET': list_realm_domains, + 'POST': create_realm_domain}), path('realm/domains/', rest_dispatch, - {'PATCH': zerver.views.realm_domains.patch_realm_domain, - 'DELETE': zerver.views.realm_domains.delete_realm_domain}), + {'PATCH': patch_realm_domain, + 'DELETE': delete_realm_domain}), # realm/emoji -> zerver.views.realm_emoji path('realm/emoji', rest_dispatch, - {'GET': zerver.views.realm_emoji.list_emoji}), + {'GET': list_emoji}), path('realm/emoji/', rest_dispatch, - {'POST': zerver.views.realm_emoji.upload_emoji, - 'DELETE': (zerver.views.realm_emoji.delete_emoji, {"intentionally_undocumented"})}), + {'POST': upload_emoji, + 'DELETE': (delete_emoji, {"intentionally_undocumented"})}), # this endpoint throws a status code 400 JsonableError when it should be a 404. # realm/icon -> zerver.views.realm_icon path('realm/icon', rest_dispatch, - {'POST': zerver.views.realm_icon.upload_icon, - 'DELETE': zerver.views.realm_icon.delete_icon_backend, - 'GET': zerver.views.realm_icon.get_icon_backend}), + {'POST': upload_icon, + 'DELETE': delete_icon_backend, + 'GET': get_icon_backend}), # realm/logo -> zerver.views.realm_logo path('realm/logo', rest_dispatch, - {'POST': zerver.views.realm_logo.upload_logo, - 'DELETE': zerver.views.realm_logo.delete_logo_backend, - 'GET': zerver.views.realm_logo.get_logo_backend}), + {'POST': upload_logo, + 'DELETE': delete_logo_backend, + 'GET': get_logo_backend}), # realm/filters -> zerver.views.realm_filters path('realm/filters', rest_dispatch, - {'GET': zerver.views.realm_filters.list_filters, - 'POST': zerver.views.realm_filters.create_filter}), + {'GET': list_filters, + 'POST': create_filter}), path('realm/filters/', rest_dispatch, - {'DELETE': zerver.views.realm_filters.delete_filter}), + {'DELETE': delete_filter}), # realm/profile_fields -> zerver.views.custom_profile_fields path('realm/profile_fields', rest_dispatch, - {'GET': zerver.views.custom_profile_fields.list_realm_custom_profile_fields, - 'PATCH': zerver.views.custom_profile_fields.reorder_realm_custom_profile_fields, - 'POST': zerver.views.custom_profile_fields.create_realm_custom_profile_field}), + {'GET': list_realm_custom_profile_fields, + 'PATCH': reorder_realm_custom_profile_fields, + 'POST': create_realm_custom_profile_field}), path('realm/profile_fields/', rest_dispatch, - {'PATCH': zerver.views.custom_profile_fields.update_realm_custom_profile_field, - 'DELETE': zerver.views.custom_profile_fields.delete_realm_custom_profile_field}), + {'PATCH': update_realm_custom_profile_field, + 'DELETE': delete_realm_custom_profile_field}), # realm/deactivate -> zerver.views.deactivate_realm path('realm/deactivate', rest_dispatch, - {'POST': zerver.views.realm.deactivate_realm}), + {'POST': deactivate_realm}), # users -> zerver.views.users path('users', rest_dispatch, - {'GET': zerver.views.users.get_members_backend, - 'POST': zerver.views.users.create_user_backend}), + {'GET': get_members_backend, + 'POST': create_user_backend}), path('users/me', rest_dispatch, - {'GET': zerver.views.users.get_profile_backend, - 'DELETE': zerver.views.users.deactivate_user_own_backend}), + {'GET': get_profile_backend, + 'DELETE': deactivate_user_own_backend}), path('users//reactivate', rest_dispatch, - {'POST': zerver.views.users.reactivate_user_backend}), + {'POST': reactivate_user_backend}), path('users/', rest_dispatch, - {'GET': zerver.views.users.get_members_backend, - 'PATCH': zerver.views.users.update_user_backend, - 'DELETE': zerver.views.users.deactivate_user_backend}), + {'GET': get_members_backend, + 'PATCH': update_user_backend, + 'DELETE': deactivate_user_backend}), path('users//subscriptions/', rest_dispatch, - {'GET': zerver.views.users.get_subscription_backend}), + {'GET': get_subscription_backend}), path('bots', rest_dispatch, - {'GET': zerver.views.users.get_bots_backend, - 'POST': zerver.views.users.add_bot_backend}), + {'GET': get_bots_backend, + 'POST': add_bot_backend}), path('bots//api_key/regenerate', rest_dispatch, - {'POST': zerver.views.users.regenerate_bot_api_key}), + {'POST': regenerate_bot_api_key}), path('bots/', rest_dispatch, - {'PATCH': zerver.views.users.patch_bot_backend, - 'DELETE': zerver.views.users.deactivate_bot_backend}), + {'PATCH': patch_bot_backend, + 'DELETE': deactivate_bot_backend}), # invites -> zerver.views.invite path('invites', rest_dispatch, - {'GET': zerver.views.invite.get_user_invites, - 'POST': zerver.views.invite.invite_users_backend}), + {'GET': get_user_invites, + 'POST': invite_users_backend}), path('invites/', rest_dispatch, - {'DELETE': zerver.views.invite.revoke_user_invite}), + {'DELETE': revoke_user_invite}), path('invites//resend', rest_dispatch, - {'POST': zerver.views.invite.resend_user_invite_email}), + {'POST': resend_user_invite_email}), # invites/multiuse -> zerver.views.invite path('invites/multiuse', rest_dispatch, - {'POST': zerver.views.invite.generate_multiuse_invite_backend}), + {'POST': generate_multiuse_invite_backend}), # invites/multiuse -> zerver.views.invite path('invites/multiuse/', rest_dispatch, - {'DELETE': zerver.views.invite.revoke_multiuse_invite}), + {'DELETE': revoke_multiuse_invite}), # mark messages as read (in bulk) path('mark_all_as_read', rest_dispatch, - {'POST': zerver.views.message_flags.mark_all_as_read}), + {'POST': mark_all_as_read}), path('mark_stream_as_read', rest_dispatch, - {'POST': zerver.views.message_flags.mark_stream_as_read}), + {'POST': mark_stream_as_read}), path('mark_topic_as_read', rest_dispatch, - {'POST': zerver.views.message_flags.mark_topic_as_read}), + {'POST': mark_topic_as_read}), path('zcommand', rest_dispatch, - {'POST': zerver.views.message_send.zcommand_backend}), + {'POST': zcommand_backend}), # Endpoints for syncing drafts. path('drafts', rest_dispatch, - {'GET': (zerver.views.drafts.fetch_drafts, + {'GET': (fetch_drafts, {'intentionally_undocumented'}), - 'POST': (zerver.views.drafts.create_drafts, + 'POST': (create_drafts, {'intentionally_undocumented'})}), path('drafts/', rest_dispatch, - {'PATCH': (zerver.views.drafts.edit_draft, + {'PATCH': (edit_draft, {'intentionally_undocumented'}), - 'DELETE': (zerver.views.drafts.delete_draft, + 'DELETE': (delete_draft, {'intentionally_undocumented'})}), # messages -> zerver.views.message* # GET returns messages, possibly filtered, POST sends a message path('messages', rest_dispatch, - {'GET': (zerver.views.message_fetch.get_messages_backend, + {'GET': (get_messages_backend, {'allow_anonymous_user_web'}), - 'POST': (zerver.views.message_send.send_message_backend, + 'POST': (send_message_backend, {'allow_incoming_webhooks'})}), path('messages/', rest_dispatch, - {'GET': zerver.views.message_edit.json_fetch_raw_message, - 'PATCH': zerver.views.message_edit.update_message_backend, - 'DELETE': zerver.views.message_edit.delete_message_backend}), + {'GET': json_fetch_raw_message, + 'PATCH': update_message_backend, + 'DELETE': delete_message_backend}), path('messages/render', rest_dispatch, - {'POST': zerver.views.message_send.render_message_backend}), + {'POST': render_message_backend}), path('messages/flags', rest_dispatch, - {'POST': zerver.views.message_flags.update_message_flags}), + {'POST': update_message_flags}), path('messages//history', rest_dispatch, - {'GET': zerver.views.message_edit.get_message_edit_history}), + {'GET': get_message_edit_history}), path('messages/matches_narrow', rest_dispatch, - {'GET': zerver.views.message_fetch.messages_in_narrow_backend}), + {'GET': messages_in_narrow_backend}), path('users/me/subscriptions/properties', rest_dispatch, - {'POST': zerver.views.streams.update_subscription_properties_backend}), + {'POST': update_subscription_properties_backend}), path('users/me/subscriptions/', rest_dispatch, - {'PATCH': zerver.views.streams.update_subscriptions_property}), + {'PATCH': update_subscriptions_property}), path('submessage', rest_dispatch, - {'POST': zerver.views.submessage.process_submessage}), + {'POST': process_submessage}), # New endpoint for handling reactions. # reactions -> zerver.view.reactions @@ -251,164 +400,164 @@ v1_api_and_json_patterns = [ # DELETE removes a reaction from a message path('messages//reactions', rest_dispatch, - {'POST': zerver.views.reactions.add_reaction, - 'DELETE': zerver.views.reactions.remove_reaction}), + {'POST': add_reaction, + 'DELETE': remove_reaction}), # attachments -> zerver.views.attachments path('attachments', rest_dispatch, - {'GET': zerver.views.attachments.list_by_user}), + {'GET': list_by_user}), path('attachments/', rest_dispatch, - {'DELETE': zerver.views.attachments.remove}), + {'DELETE': remove}), # typing -> zerver.views.typing # POST sends a typing notification event to recipients path('typing', rest_dispatch, - {'POST': zerver.views.typing.send_notification_backend}), + {'POST': send_notification_backend}), # user_uploads -> zerver.views.upload path('user_uploads', rest_dispatch, - {'POST': zerver.views.upload.upload_file_backend}), + {'POST': upload_file_backend}), path('user_uploads//', rest_dispatch, - {'GET': (zerver.views.upload.serve_file_url_backend, + {'GET': (serve_file_url_backend, {'override_api_url_scheme'})}), # bot_storage -> zerver.views.storage path('bot_storage', rest_dispatch, - {'PUT': zerver.views.storage.update_storage, - 'GET': zerver.views.storage.get_storage, - 'DELETE': zerver.views.storage.remove_storage}), + {'PUT': update_storage, + 'GET': get_storage, + 'DELETE': remove_storage}), # Endpoint used by mobile devices to register their push # notification credentials path('users/me/apns_device_token', rest_dispatch, - {'POST': zerver.views.push_notifications.add_apns_device_token, - 'DELETE': zerver.views.push_notifications.remove_apns_device_token}), + {'POST': add_apns_device_token, + 'DELETE': remove_apns_device_token}), path('users/me/android_gcm_reg_id', rest_dispatch, - {'POST': zerver.views.push_notifications.add_android_reg_id, - 'DELETE': zerver.views.push_notifications.remove_android_reg_id}), + {'POST': add_android_reg_id, + 'DELETE': remove_android_reg_id}), # users/*/presnece => zerver.views.presence. path('users/me/presence', rest_dispatch, - {'POST': zerver.views.presence.update_active_status_backend}), + {'POST': update_active_status_backend}), # It's important that this sit after users/me/presence so that # Django's URL resolution order doesn't break the # /users/me/presence endpoint. path(r'users//presence', rest_dispatch, - {'GET': zerver.views.presence.get_presence_backend}), + {'GET': get_presence_backend}), path('realm/presence', rest_dispatch, - {'GET': zerver.views.presence.get_statuses_for_realm}), + {'GET': get_statuses_for_realm}), path('users/me/status', rest_dispatch, - {'POST': zerver.views.presence.update_user_status_backend}), + {'POST': update_user_status_backend}), # user_groups -> zerver.views.user_groups path('user_groups', rest_dispatch, - {'GET': zerver.views.user_groups.get_user_group}), + {'GET': get_user_group}), path('user_groups/create', rest_dispatch, - {'POST': zerver.views.user_groups.add_user_group}), + {'POST': add_user_group}), path('user_groups/', rest_dispatch, - {'PATCH': zerver.views.user_groups.edit_user_group, - 'DELETE': zerver.views.user_groups.delete_user_group}), + {'PATCH': edit_user_group, + 'DELETE': delete_user_group}), path('user_groups//members', rest_dispatch, - {'POST': zerver.views.user_groups.update_user_group_backend}), + {'POST': update_user_group_backend}), # users/me -> zerver.views.user_settings path('users/me/api_key/regenerate', rest_dispatch, - {'POST': zerver.views.user_settings.regenerate_api_key}), + {'POST': regenerate_api_key}), path('users/me/enter-sends', rest_dispatch, - {'POST': (zerver.views.user_settings.change_enter_sends, + {'POST': (change_enter_sends, # This endpoint should be folded into user settings {'intentionally_undocumented'})}), path('users/me/avatar', rest_dispatch, - {'POST': zerver.views.user_settings.set_avatar_backend, - 'DELETE': zerver.views.user_settings.delete_avatar_backend}), + {'POST': set_avatar_backend, + 'DELETE': delete_avatar_backend}), # users/me/hotspots -> zerver.views.hotspots path('users/me/hotspots', rest_dispatch, - {'POST': (zerver.views.hotspots.mark_hotspot_as_read, + {'POST': (mark_hotspot_as_read, # This endpoint is low priority for documentation as # it is part of the webapp-specific tutorial. {'intentionally_undocumented'})}), # users/me/tutorial_status -> zerver.views.tutorial path('users/me/tutorial_status', rest_dispatch, - {'POST': (zerver.views.tutorial.set_tutorial_status, + {'POST': (set_tutorial_status, # This is a relic of an old Zulip tutorial model and # should be deleted. {'intentionally_undocumented'})}), # settings -> zerver.views.user_settings path('settings', rest_dispatch, - {'PATCH': zerver.views.user_settings.json_change_settings}), + {'PATCH': json_change_settings}), path('settings/display', rest_dispatch, - {'PATCH': zerver.views.user_settings.update_display_settings_backend}), + {'PATCH': update_display_settings_backend}), path('settings/notifications', rest_dispatch, - {'PATCH': zerver.views.user_settings.json_change_notify_settings}), + {'PATCH': json_change_notify_settings}), # users/me/alert_words -> zerver.views.alert_words path('users/me/alert_words', rest_dispatch, - {'GET': zerver.views.alert_words.list_alert_words, - 'POST': zerver.views.alert_words.add_alert_words, - 'DELETE': zerver.views.alert_words.remove_alert_words}), + {'GET': list_alert_words, + 'POST': add_alert_words, + 'DELETE': remove_alert_words}), # users/me/custom_profile_data -> zerver.views.custom_profile_data path('users/me/profile_data', rest_dispatch, - {'PATCH': zerver.views.custom_profile_fields.update_user_custom_profile_data, - 'DELETE': zerver.views.custom_profile_fields.remove_user_custom_profile_data}), + {'PATCH': update_user_custom_profile_data, + 'DELETE': remove_user_custom_profile_data}), path('users/me//topics', rest_dispatch, - {'GET': (zerver.views.streams.get_topics_backend, + {'GET': (get_topics_backend, {'allow_anonymous_user_web'})}), # streams -> zerver.views.streams # (this API is only used externally) path('streams', rest_dispatch, - {'GET': zerver.views.streams.get_streams_backend}), + {'GET': get_streams_backend}), # GET returns `stream_id`, stream name should be encoded in the url query (in `stream` param) path('get_stream_id', rest_dispatch, - {'GET': zerver.views.streams.json_get_stream_id}), + {'GET': json_get_stream_id}), # GET returns "stream info" (undefined currently?), HEAD returns whether stream exists (200 or 404) path('streams//members', rest_dispatch, - {'GET': zerver.views.streams.get_subscribers_backend}), + {'GET': get_subscribers_backend}), path('streams/', rest_dispatch, - {'PATCH': zerver.views.streams.update_stream_backend, - 'DELETE': zerver.views.streams.deactivate_stream_backend}), + {'PATCH': update_stream_backend, + 'DELETE': deactivate_stream_backend}), # Delete topic in stream path('streams//delete_topic', rest_dispatch, - {'POST': zerver.views.streams.delete_in_topic}), + {'POST': delete_in_topic}), path('default_streams', rest_dispatch, - {'POST': zerver.views.streams.add_default_stream, - 'DELETE': zerver.views.streams.remove_default_stream}), + {'POST': add_default_stream, + 'DELETE': remove_default_stream}), path('default_stream_groups/create', rest_dispatch, - {'POST': zerver.views.streams.create_default_stream_group}), + {'POST': create_default_stream_group}), path('default_stream_groups/', rest_dispatch, - {'PATCH': zerver.views.streams.update_default_stream_group_info, - 'DELETE': zerver.views.streams.remove_default_stream_group}), + {'PATCH': update_default_stream_group_info, + 'DELETE': remove_default_stream_group}), path('default_stream_groups//streams', rest_dispatch, - {'PATCH': zerver.views.streams.update_default_stream_group_streams}), + {'PATCH': update_default_stream_group_streams}), # GET lists your streams, POST bulk adds, PATCH bulk modifies/removes path('users/me/subscriptions', rest_dispatch, - {'GET': zerver.views.streams.list_subscriptions_backend, - 'POST': zerver.views.streams.add_subscriptions_backend, - 'PATCH': zerver.views.streams.update_subscriptions_backend, - 'DELETE': zerver.views.streams.remove_subscriptions_backend}), + {'GET': list_subscriptions_backend, + 'POST': add_subscriptions_backend, + 'PATCH': update_subscriptions_backend, + 'DELETE': remove_subscriptions_backend}), # muting -> zerver.views.muting path('users/me/subscriptions/muted_topics', rest_dispatch, - {'PATCH': zerver.views.muting.update_muted_topic}), + {'PATCH': update_muted_topic}), # used to register for an event queue in tornado path('register', rest_dispatch, - {'POST': zerver.views.events_register.events_register_backend}), + {'POST': events_register_backend}), # events -> zerver.tornado.views path('events', rest_dispatch, - {'GET': zerver.tornado.views.get_events, - 'DELETE': zerver.tornado.views.cleanup_event_queue}), + {'GET': get_events, + 'DELETE': cleanup_event_queue}), # report -> zerver.views.report # @@ -417,30 +566,30 @@ v1_api_and_json_patterns = [ # include in our API documentation. path('report/error', rest_dispatch, # Logged-out browsers can hit this endpoint, for portico page JS exceptions. - {'POST': (zerver.views.report.report_error, {'allow_anonymous_user_web', - 'intentionally_undocumented'})}), + {'POST': (report_error, {'allow_anonymous_user_web', + 'intentionally_undocumented'})}), path('report/send_times', rest_dispatch, - {'POST': (zerver.views.report.report_send_times, {'intentionally_undocumented'})}), + {'POST': (report_send_times, {'intentionally_undocumented'})}), path('report/narrow_times', rest_dispatch, - {'POST': (zerver.views.report.report_narrow_times, {'allow_anonymous_user_web', - 'intentionally_undocumented'})}), + {'POST': (report_narrow_times, {'allow_anonymous_user_web', + 'intentionally_undocumented'})}), path('report/unnarrow_times', rest_dispatch, - {'POST': (zerver.views.report.report_unnarrow_times, {'allow_anonymous_user_web', - 'intentionally_undocumented'})}), + {'POST': (report_unnarrow_times, {'allow_anonymous_user_web', + 'intentionally_undocumented'})}), # Used to generate a Zoom video call URL path('calls/zoom/create', rest_dispatch, - {'POST': zerver.views.video_calls.make_zoom_video_call}), + {'POST': make_zoom_video_call}), # Used to generate a Big Blue Button video call URL path('calls/bigbluebutton/create', rest_dispatch, - {'GET': zerver.views.video_calls.get_bigbluebutton_url}), + {'GET': get_bigbluebutton_url}), # export/realm -> zerver.views.realm_export path('export/realm', rest_dispatch, - {'POST': zerver.views.realm_export.export_realm, - 'GET': zerver.views.realm_export.get_realm_exports}), + {'POST': export_realm, + 'GET': get_realm_exports}), path('export/realm/', rest_dispatch, - {'DELETE': zerver.views.realm_export.delete_realm_export}), + {'DELETE': delete_realm_export}), ] integrations_view = IntegrationView.as_view() @@ -451,64 +600,64 @@ integrations_view = IntegrationView.as_view() # If you're adding a new page to the website (as opposed to a new # endpoint for use by code), you should add it here. i18n_urls = [ - path('', zerver.views.home.home, name='home'), + path('', home, name='home'), # We have a desktop-specific landing page in case we change our / # to not log in in the future. We don't want to require a new # desktop app build for everyone in that case - path('desktop_home/', zerver.views.home.desktop_home), + path('desktop_home/', desktop_home), # Backwards-compatibility (legacy) Google auth URL for the mobile # apps; see https://github.com/zulip/zulip/issues/13081 for # background. We can remove this once older versions of the # mobile app are no longer present in the wild. - path('accounts/login/google/', zerver.views.auth.start_social_login, {"backend": "google"}), + path('accounts/login/google/', start_social_login, {"backend": "google"}), - path('accounts/login/start/sso/', zerver.views.auth.start_remote_user_sso, name='start-login-sso'), - path('accounts/login/sso/', zerver.views.auth.remote_user_sso, name='login-sso'), - path('accounts/login/jwt/', zerver.views.auth.remote_user_jwt), - path('accounts/login/social/', zerver.views.auth.start_social_login, + path('accounts/login/start/sso/', start_remote_user_sso, name='start-login-sso'), + path('accounts/login/sso/', remote_user_sso, name='login-sso'), + path('accounts/login/jwt/', remote_user_jwt), + path('accounts/login/social/', start_social_login, name='login-social'), - path('accounts/login/social//', zerver.views.auth.start_social_login, + path('accounts/login/social//', start_social_login, name='login-social'), path('accounts/register/social/', - zerver.views.auth.start_social_signup, + start_social_signup, name='signup-social'), path('accounts/register/social//', - zerver.views.auth.start_social_signup, + start_social_signup, name='signup-social'), - path('accounts/login/subdomain/', zerver.views.auth.log_into_subdomain), - path('accounts/login/local/', zerver.views.auth.dev_direct_login, name='login-local'), + path('accounts/login/subdomain/', log_into_subdomain), + path('accounts/login/local/', dev_direct_login, name='login-local'), # We have two entries for accounts/login; only the first one is # used for URL resolution. The second here is to allow # reverse("login") in templates to # return `/accounts/login/`. - path('accounts/login/', zerver.views.auth.login_page, + path('accounts/login/', login_page, {'template_name': 'zerver/login.html'}, name='login_page'), path('accounts/login/', LoginView.as_view(template_name='zerver/login.html'), name='login'), - path('accounts/logout/', zerver.views.auth.logout_then_login), + path('accounts/logout/', logout_then_login), path('accounts/webathena_kerberos_login/', - zerver.views.zephyr.webathena_kerberos_login), + webathena_kerberos_login), - path('accounts/password/reset/', zerver.views.auth.password_reset, name='password_reset'), + path('accounts/password/reset/', password_reset, name='password_reset'), path('accounts/password/reset/done/', PasswordResetDoneView.as_view(template_name='zerver/reset_emailed.html')), path('accounts/password/reset///', PasswordResetConfirmView.as_view(success_url='/accounts/password/done/', template_name='zerver/reset_confirm.html', - form_class=zerver.forms.LoggingSetPasswordForm), + form_class=LoggingSetPasswordForm), name='password_reset_confirm'), path('accounts/password/done/', PasswordResetCompleteView.as_view(template_name='zerver/reset_done.html')), path('accounts/deactivated/', - zerver.views.auth.show_deactivation_notice), + show_deactivation_notice), # Displays digest email content in browser. - path('digest/', zerver.views.digest.digest_page), + path('digest/', digest_page), # Registration views, require a confirmation ID. - path('accounts/home/', zerver.views.registration.accounts_home), + path('accounts/home/', accounts_home), path('accounts/send_confirm/', TemplateView.as_view( template_name='zerver/accounts_send_confirm.html'), @@ -517,94 +666,94 @@ i18n_urls = [ TemplateView.as_view( template_name='zerver/accounts_send_confirm.html'), {'realm_creation': True}, name='new_realm_send_confirm'), - path('accounts/register/', zerver.views.registration.accounts_register, name='accounts_register'), + path('accounts/register/', accounts_register, name='accounts_register'), path('accounts/do_confirm/', - zerver.views.registration.check_prereg_key_and_redirect, + check_prereg_key_and_redirect, name='check_prereg_key_and_redirect'), path('accounts/confirm_new_email/', - zerver.views.user_settings.confirm_email_change, + confirm_email_change, name='confirm_email_change'), # Email unsubscription endpoint. Allows for unsubscribing from various types of emails, # including the welcome emails (day 1 & 2), missed PMs, etc. path('accounts/unsubscribe//', - zerver.views.unsubscribe.email_unsubscribe, name='unsubscribe'), + email_unsubscribe, name='unsubscribe'), # Portico-styled page used to provide email confirmation of terms acceptance. - path('accounts/accept_terms/', zerver.views.home.accounts_accept_terms, name='accept_terms'), + path('accounts/accept_terms/', accounts_accept_terms, name='accept_terms'), # Find your account - path('accounts/find/', zerver.views.registration.find_account, name='find_account'), + path('accounts/find/', find_account, name='find_account'), # Go to organization subdomain - path('accounts/go/', zerver.views.registration.realm_redirect, name='realm_redirect'), + path('accounts/go/', realm_redirect, name='realm_redirect'), # Realm Creation - path('new/', zerver.views.registration.create_realm), + path('new/', create_realm), path('new/', - zerver.views.registration.create_realm, name='create_realm'), + create_realm, name='create_realm'), # Realm Reactivation - path('reactivate/', zerver.views.realm.realm_reactivation, + path('reactivate/', realm_reactivation, name='realm_reactivation'), # Global public streams (Zulip's way of doing archives) path('archive/streams//topics/', - zerver.views.archive.archive), + archive), path('archive/streams//topics', - zerver.views.archive.get_web_public_topics_backend), + get_web_public_topics_backend), # Login/registration - path('register/', zerver.views.registration.accounts_home, name='register'), - path('login/', zerver.views.auth.login_page, {'template_name': 'zerver/login.html'}, + path('register/', accounts_home, name='register'), + path('login/', login_page, {'template_name': 'zerver/login.html'}, name='login_page'), path('join//', - zerver.views.registration.accounts_home_from_multiuse_invite, name='join'), + accounts_home_from_multiuse_invite, name='join'), # Used to generate a Zoom video call URL - path('calls/zoom/register', zerver.views.video_calls.register_zoom_user), - path('calls/zoom/complete', zerver.views.video_calls.complete_zoom_user), - path('calls/zoom/deauthorize', zerver.views.video_calls.deauthorize_zoom_user), + path('calls/zoom/register', register_zoom_user), + path('calls/zoom/complete', complete_zoom_user), + path('calls/zoom/deauthorize', deauthorize_zoom_user), # Used to join a Big Blue Button video call - path('calls/bigbluebutton/join', zerver.views.video_calls.join_bigbluebutton), + path('calls/bigbluebutton/join', join_bigbluebutton), # API and integrations documentation path('integrations/doc-html/', - zerver.views.documentation.integration_doc), + integration_doc), path('integrations/', integrations_view), path('integrations/', integrations_view), # Landing page, features pages, signup form, etc. - path('hello/', zerver.views.portico.hello_view), + path('hello/', hello_view), path('new-user/', RedirectView.as_view(url='/hello', permanent=True)), - path('features/', zerver.views.portico.landing_view, {'template_name': 'zerver/features.html'}), - path('plans/', zerver.views.portico.plans_view, name='plans'), - path('apps/', zerver.views.portico.apps_view), - path('apps/', zerver.views.portico.apps_view), - path('team/', zerver.views.portico.team_view), - path('history/', zerver.views.portico.landing_view, {'template_name': 'zerver/history.html'}), - path('why-zulip/', zerver.views.portico.landing_view, {'template_name': 'zerver/why-zulip.html'}), - path('for/open-source/', zerver.views.portico.landing_view, + path('features/', landing_view, {'template_name': 'zerver/features.html'}), + path('plans/', plans_view, name='plans'), + path('apps/', apps_view), + path('apps/', apps_view), + path('team/', team_view), + path('history/', landing_view, {'template_name': 'zerver/history.html'}), + path('why-zulip/', landing_view, {'template_name': 'zerver/why-zulip.html'}), + path('for/open-source/', landing_view, {'template_name': 'zerver/for-open-source.html'}), - path('for/research/', zerver.views.portico.landing_view, + path('for/research/', landing_view, {'template_name': 'zerver/for-research.html'}), - path('for/companies/', zerver.views.portico.landing_view, + path('for/companies/', landing_view, {'template_name': 'zerver/for-companies.html'}), - path('for/working-groups-and-communities/', zerver.views.portico.landing_view, + path('for/working-groups-and-communities/', landing_view, {'template_name': 'zerver/for-working-groups-and-communities.html'}), - path('security/', zerver.views.portico.landing_view, {'template_name': 'zerver/security.html'}), - path('atlassian/', zerver.views.portico.landing_view, {'template_name': 'zerver/atlassian.html'}), + path('security/', landing_view, {'template_name': 'zerver/security.html'}), + path('atlassian/', landing_view, {'template_name': 'zerver/atlassian.html'}), # Terms of Service and privacy pages. - path('terms/', zerver.views.portico.terms_view), - path('privacy/', zerver.views.portico.privacy_view), - path('config-error/', zerver.views.auth.config_error_view, + path('terms/', terms_view), + path('privacy/', privacy_view), + path('config-error/', config_error_view, name='config_error'), path('config-error/remoteuser/', - zerver.views.auth.config_error_view), + config_error_view), ] # Make a copy of i18n_urls so that they appear without prefix for english @@ -626,26 +775,26 @@ urls += [ # 'override_api_url_scheme' flag passed to rest_dispatch urls += [ path('user_uploads/temporary//', - zerver.views.upload.serve_local_file_unauthed, + serve_local_file_unauthed, name='local_file_unauthed'), path('user_uploads//', rest_dispatch, - {'GET': (zerver.views.upload.serve_file_backend, + {'GET': (serve_file_backend, {'override_api_url_scheme'})}), # This endpoint serves thumbnailed versions of images using thumbor; # it requires an exception for the same reason. path('thumbnail', rest_dispatch, - {'GET': (zerver.views.thumbnail.backend_serve_thumbnail, + {'GET': (backend_serve_thumbnail, {'override_api_url_scheme'})}), # Avatars have the same constraint because their URLs are included # in API data structures used by both the mobile and web clients. path('avatar/', rest_dispatch, - {'GET': (zerver.views.users.avatar, + {'GET': (avatar, {'override_api_url_scheme'})}), path('avatar//medium', rest_dispatch, - {'GET': (zerver.views.users.avatar, + {'GET': (avatar, {'override_api_url_scheme'}), 'medium': True}), ] @@ -653,7 +802,7 @@ urls += [ # This url serves as a way to receive CSP violation reports from the users. # We use this endpoint to just log these reports. urls += [ - path('report/csp_violations', zerver.views.report.report_csp_violations), + path('report/csp_violations', report_csp_violations), ] # This url serves as a way to provide backward compatibility to messages @@ -662,7 +811,7 @@ urls += [ # images. urls += [ path('external_content//', - zerver.views.camo.handle_camo_url), + handle_camo_url), ] # Incoming webhook URLs @@ -675,7 +824,7 @@ for incoming_webhook in WEBHOOK_INTEGRATIONS: # Desktop-specific authentication URLs urls += [ path('json/fetch_api_key', rest_dispatch, - {'POST': zerver.views.auth.json_fetch_api_key}), + {'POST': json_fetch_api_key}), ] # Mobile-specific authentication URLs @@ -683,7 +832,7 @@ urls += [ # Used as a global check by all mobile clients, which currently send # requests to https://zulip.com/compatibility almost immediately after # starting up. - path('compatibility', zerver.views.compatibility.check_global_compatibility), + path('compatibility', check_global_compatibility), ] v1_api_mobile_patterns = [ @@ -691,20 +840,20 @@ v1_api_mobile_patterns = [ # authentication backends the server allows as well as details # like the requested subdomains'd realm icon (if known) and # server-specific compatibility. - path('server_settings', zerver.views.auth.api_get_server_settings), + path('server_settings', api_get_server_settings), # This json format view used by the mobile apps accepts a username # password/pair and returns an API key. - path('fetch_api_key', zerver.views.auth.api_fetch_api_key), + path('fetch_api_key', api_fetch_api_key), # This is for the signing in through the devAuthBackEnd on mobile apps. - path('dev_fetch_api_key', zerver.views.auth.api_dev_fetch_api_key), + path('dev_fetch_api_key', api_dev_fetch_api_key), # This is for fetching the emails of the admins and the users. - path('dev_list_users', zerver.views.auth.api_dev_list_users), + path('dev_list_users', api_dev_list_users), # Used to present the GOOGLE_CLIENT_ID to mobile apps path('fetch_google_client_id', - zerver.views.auth.api_fetch_google_client_id), + api_fetch_google_client_id), ] urls += [ path('api/v1/', include(v1_api_mobile_patterns)), @@ -712,7 +861,7 @@ urls += [ # View for uploading messages from email mirror urls += [ - path('email_mirror_message', zerver.views.email_mirror.email_mirror_message), + path('email_mirror_message', email_mirror_message), ] # Include URL configuration files for site-specified extra installed @@ -729,14 +878,14 @@ urls += [ # # Since these views don't use rest_dispatch, they cannot have # asynchronous Tornado behavior. - path('notify_tornado', zerver.tornado.views.notify), - path('api/v1/events/internal', zerver.tornado.views.get_events_internal), + path('notify_tornado', notify), + path('api/v1/events/internal', get_events_internal), ] # Python Social Auth urls += [path('', include('social_django.urls', namespace='social'))] -urls += [path('saml/metadata.xml', zerver.views.auth.saml_sp_metadata)] +urls += [path('saml/metadata.xml', saml_sp_metadata)] # User documentation site help_documentation_view = MarkdownDirectoryView.as_view(