mirror of
https://github.com/zulip/zulip.git
synced 2025-11-06 23:13:25 +00:00
`request.user` gets set in Django's `AuthenticationMiddleware`, which runs after our `HostDomainMiddleware`. This makes `hasattr` checks necessary in any code path that uses the `request.user` attribute. In this case, there are functions in `context_processors` that get called in the middleware. Since neither `CsrfMiddleware` nor `HostDomainMiddleware` are required to run before `AuthenticationMiddleware`, moving it two slots up in `computed_settings` is sufficient to avoid the `hasattr` checks. Signed-off-by: Zixuan James Li <p359101898@gmail.com>
9.2 KiB
9.2 KiB