mirror of
https://github.com/zulip/zulip.git
synced 2025-10-23 04:52:12 +00:00
refactor: Move dev related code from urls.py
to dev_urls.py
.
This commit is contained in:
@@ -11,6 +11,11 @@ from django.views.static import serve
|
||||
|
||||
from zerver.views.auth import config_error, login_page
|
||||
from zerver.views.development.cache import remove_caches
|
||||
from zerver.views.development.dev_login import (
|
||||
api_dev_fetch_api_key,
|
||||
api_dev_list_users,
|
||||
dev_direct_login,
|
||||
)
|
||||
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,
|
||||
@@ -83,6 +88,12 @@ urls = [
|
||||
path("flush_caches", remove_caches),
|
||||
]
|
||||
|
||||
v1_api_mobile_patterns = [
|
||||
# This is for the signing in through the devAuthBackEnd on mobile apps.
|
||||
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", api_dev_list_users),
|
||||
]
|
||||
# Serve static assets via the Django server
|
||||
if use_prod_static:
|
||||
urls += [
|
||||
@@ -98,6 +109,7 @@ else:
|
||||
urls += static(urlsplit(settings.STATIC_URL).path, view=serve_static)
|
||||
|
||||
i18n_urls = [
|
||||
path("accounts/login/local/", dev_direct_login, name="login-local"),
|
||||
path("confirmation_key/", confirmation_key),
|
||||
]
|
||||
urls += i18n_urls
|
||||
|
@@ -47,11 +47,6 @@ from zerver.views.custom_profile_fields import (
|
||||
update_realm_custom_profile_field,
|
||||
update_user_custom_profile_data,
|
||||
)
|
||||
from zerver.views.development.dev_login import (
|
||||
api_dev_fetch_api_key,
|
||||
api_dev_list_users,
|
||||
dev_direct_login,
|
||||
)
|
||||
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
|
||||
@@ -531,7 +526,6 @@ i18n_urls = [
|
||||
"accounts/register/social/<backend>/<extra_arg>", start_social_signup, name="signup-social"
|
||||
),
|
||||
path("accounts/login/subdomain/<token>", 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
|
||||
@@ -726,13 +720,6 @@ v1_api_mobile_patterns = [
|
||||
# This json format view used by the mobile apps accepts a username
|
||||
# password/pair and returns an 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", api_dev_fetch_api_key),
|
||||
# This is for fetching the emails of the admins and the users.
|
||||
path("dev_list_users", api_dev_list_users),
|
||||
]
|
||||
urls += [
|
||||
path("api/v1/", include(v1_api_mobile_patterns)),
|
||||
]
|
||||
|
||||
# View for uploading messages from email mirror
|
||||
@@ -793,6 +780,11 @@ if settings.TWO_FACTOR_AUTHENTICATION_ENABLED:
|
||||
if settings.DEVELOPMENT:
|
||||
urls += dev_urls.urls
|
||||
i18n_urls += dev_urls.i18n_urls
|
||||
v1_api_mobile_patterns += dev_urls.v1_api_mobile_patterns
|
||||
|
||||
urls += [
|
||||
path("api/v1/", include(v1_api_mobile_patterns)),
|
||||
]
|
||||
|
||||
# The sequence is important; if i18n URLs don't come first then
|
||||
# reverse URL mapping points to i18n URLs which causes the frontend
|
||||
|
Reference in New Issue
Block a user