Fix /versions requests (#17410)

We need it to work on workers and allow guest access.

Broke by #17392
This commit is contained in:
Erik Johnston 2024-07-09 10:25:44 +01:00 committed by GitHub
parent 1353fb3347
commit 0ed1c64c83
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 11 additions and 1 deletions

1
changelog.d/17410.misc Normal file
View file

@ -0,0 +1 @@
Finish up work to allow per-user feature flags.

View file

@ -74,6 +74,9 @@ from synapse.storage.databases.main.event_push_actions import (
EventPushActionsWorkerStore,
)
from synapse.storage.databases.main.events_worker import EventsWorkerStore
from synapse.storage.databases.main.experimental_features import (
ExperimentalFeaturesStore,
)
from synapse.storage.databases.main.filtering import FilteringWorkerStore
from synapse.storage.databases.main.keys import KeyStore
from synapse.storage.databases.main.lock import LockStore
@ -155,6 +158,7 @@ class GenericWorkerStore(
LockStore,
SessionStore,
TaskSchedulerWorkerStore,
ExperimentalFeaturesStore,
):
# Properties that multiple storage classes define. Tell mypy what the
# expected type is.

View file

@ -66,7 +66,12 @@ class VersionsRestServlet(RestServlet):
msc3881_enabled = self.config.experimental.msc3881_enabled
if self.auth.has_access_token(request):
requester = await self.auth.get_user_by_req(request)
requester = await self.auth.get_user_by_req(
request,
allow_guest=True,
allow_locked=True,
allow_expired=True,
)
user_id = requester.user.to_string()
msc3881_enabled = await self.store.is_feature_enabled(