mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 13:33:24 +00:00
apps: Fix redirect from /apps -> https://zulip.com/apps/.
When this code was moved from being in zerver in21a2fd482e, it kept the `if ZILENCER_ENABLED` blocks. Since ZILENCER and CORPORATE are generally either both on or both off, the if statement became mostly-unnecessary. However, because tests cannot easily remove elements from INSTALLED_APPS and re-determine URL resolution, we switch to checking `if CORPORATE_ENABLED` as a guard, and leave these in-place. The other side effect of this is that withe54ded49c4, most Zulip deployments started to 404 requests for `/apps` instead of redirecting them to `https://zulip.com/apps/` since they no longer had any path configured for `/apps`. Unfortunately, this URL is in widespread use in the app (e.g. in links from the Welcome Bot), so we should ensure that it does successfully redirect. Add the `/apps` path to `zerver`, but only if not CORPORATE_ENABLED, so the URLs do not overlap.
This commit is contained in:
committed by
Tim Abbott
parent
13ad9e8323
commit
7613928e8a
@@ -798,6 +798,14 @@ urls += [
|
||||
path("policies/<slug:article>", policy_documentation_view),
|
||||
]
|
||||
|
||||
if not settings.CORPORATE_ENABLED:
|
||||
# This conditional behavior cannot be tested directly, since
|
||||
# urls.py is not readily reloaded in Django tests. See the block
|
||||
# comment inside apps_view for details.
|
||||
urls += [
|
||||
path("apps/", RedirectView.as_view(url="https://zulip.com/apps/", permanent=True)),
|
||||
]
|
||||
|
||||
# Two-factor URLs
|
||||
if settings.TWO_FACTOR_AUTHENTICATION_ENABLED:
|
||||
urls += [path("", include(tf_urls)), path("", include(tf_twilio_urls))]
|
||||
|
||||
Reference in New Issue
Block a user