zulip/zerver
Tim Abbott 24f527cb59 home: Don't send /register response for spectators.
In very large communities, computing page_params can be quite
expensive. Because we've moved the homepage for communities with web
public streams enabled to be the Zulip app, and it's common for
automation to frequently poll the homepage of a Zulip organization,
we'd like to keep those homepages cheap (as the login pages are).

We address this by prototyping something we may end up wanting to do
anyway -- having the web application do a `POST /register` API call in
order to fetch most page_params, and merging those with the mostly
webapp configuration page_params that we leave in the / response for
convenience.

This exact implementation is messy in a few ways:

* We rely on the assumption that ui_init.initialize_everything happens
  before all code that needs to inspect the page_params properties we
  are fetching via /register. This is likely mostly true, but nothing
  in the implementation enforces it.
* The bundle of ~25 keys that are in page_params ideally would be
  considered individually, with some moved to the /register API
  response and perhaps others eliminated or namespaced inside a
  webapp_settings object.
* It's weird to have the spectators network sequence different that
  from logged-in users, and potentially a maintainability risk.
* We might be able to arrange that the initial `/` response be
  cacheable, now that we're no longer embedding our metadata inside
  it. We've made no effort to do that as of yet.

Despite those issues, this commit solves an immediate problem and will
give us helpful experience with a model closer to the one we'll want
in order to happily support a web client that can be run locally
against a production Zulip server's data.

Co-authored-by: Anders Kaseorg <anders@zulip.com>
2022-05-05 15:20:46 -07:00
..
actions message_edit: Filter UserMessage better, now that mentions are unneeded. 2022-05-04 14:45:18 -07:00
data_import python: Use Python 3.8 typing.{Protocol,TypedDict}. 2022-04-27 12:57:49 -07:00
integration_fixtures/nagios tests: Add a test for fixtures for non-webhook integrations. 2021-04-28 08:16:51 -07:00
lib home: Don't send /register response for spectators. 2022-05-05 15:20:46 -07:00
management requirements: Upgrade to Tornado 6. 2022-05-02 17:41:49 -07:00
migrations settings: Add realm setting for Zulip communities directory. 2022-05-04 11:13:28 -07:00
openapi events: Add support for spectator access to /register. 2022-05-05 15:20:44 -07:00
tests home: Don't send /register response for spectators. 2022-05-05 15:20:46 -07:00
tornado requirements: Upgrade Python requirements. 2022-05-03 10:10:06 -07:00
views events: Add support for spectator access to /register. 2022-05-05 15:20:44 -07:00
webhooks testing: Improve backend code coverage for semaphore webhook. 2022-05-04 16:13:24 -07:00
worker message_send: Remove unnecessary user_ids argument. 2022-05-04 14:45:18 -07:00
__init__.py django: Upgrade Zulip to Django 3.2 LTS. 2021-05-03 08:36:22 -07:00
apps.py caching: Make sender type optional for flush_cache. 2021-07-26 14:48:07 -07:00
context_processors.py home: Simplify and comment terms of service notice implementation. 2022-02-04 15:48:38 -08:00
decorator.py decorator: Strengthen decorator types using ParamSpec. 2022-04-14 12:44:35 -07:00
filters.py typing: Fix function signatures. 2021-08-20 05:54:19 -07:00
forms.py auth: Don't leak info about accounts in other realms in the login form. 2022-05-03 17:06:51 -07:00
logging_handlers.py python: Use Python 3.8 typing.{Protocol,TypedDict}. 2022-04-27 12:57:49 -07:00
middleware.py middleware: Add `client` REQ parameter to `parse_client`. 2022-04-08 11:29:33 -07:00
models.py settings: Add realm setting for Zulip communities directory. 2022-05-04 11:13:28 -07:00
signals.py actions: Split out zerver.actions.video_calls. 2022-04-14 17:14:30 -07:00